Procházet zdrojové kódy

Removed Id creation on registering as SQL handles it now

master
Lene před 4 roky
rodič
revize
b0128bdaf1

+ 1
- 1
UnivateProperties_API/Repository/IRepository.cs Zobrazit soubor

@@ -16,7 +16,7 @@ namespace UnivateProperties_API.Repository
16 16
         void Remove(IEnumerable<TEntity> items);
17 17
         void RemoveAtId(int item);
18 18
         void Update(TEntity item);
19
-        int NewId();
19
+        //int NewId();
20 20
         void Save();
21 21
     }
22 22
 }

+ 47
- 47
UnivateProperties_API/Repository/Users/RegisterRepository.cs Zobrazit soubor

@@ -52,7 +52,7 @@ namespace UnivateProperties_API.Repository.Users
52 52
 
53 53
             user.PasswordHash = passwordHash;
54 54
             user.PasswordSalt = passwordSalt;
55
-            user.Id = NewUserId();
55
+            //user.Id = NewUserId();
56 56
             _dbContext.Users.Add(user);
57 57
             if (save)
58 58
             {
@@ -77,7 +77,7 @@ namespace UnivateProperties_API.Repository.Users
77 77
                 EAABEFFCNumber = agency.EaabeffcNumber,
78 78
                 CompanyRegNumber = agency.RegNo
79 79
             };
80
-            a.Id = NewAgencyId();
80
+            //a.Id = NewAgencyId();
81 81
             _dbContext.Agencies.Add(a);
82 82
             CreatePerson(agency.User, PersonType.Agent, false, a);
83 83
 
@@ -115,7 +115,7 @@ namespace UnivateProperties_API.Repository.Users
115 115
                     Telephone = individual.Telephone,
116 116
                     Agency = agency
117 117
                 };
118
-                agent.Id = NewAgentId();
118
+                //agent.Id = NewAgentId();
119 119
                 agent.User.Role = Role.Agency;
120 120
                 p = agent;
121 121
                 _dbContext.Agents.Add(agent);
@@ -131,7 +131,7 @@ namespace UnivateProperties_API.Repository.Users
131 131
                     CellNumber = individual.CellNumber,
132 132
                     Telephone = individual.Telephone
133 133
                 };
134
-                i.Id = NewIndividualId();
134
+                //i.Id = NewIndividualId();
135 135
                 i.User.Role = Role.PrivateUser;
136 136
                 p = i;
137 137
                 _dbContext.Individuals.Add(i);
@@ -262,49 +262,49 @@ namespace UnivateProperties_API.Repository.Users
262 262
             _dbContext.SaveChanges();
263 263
         }
264 264
 
265
-        public int NewAgencyId()
266
-        {
267
-            int id = 0;
268
-            if (_dbContext.Agencies.Count() > 0)
269
-            {
270
-                id = _dbContext.Agencies.Max(x => x.Id);
271
-            }
272
-            id += 1;
273
-            return id;
274
-        }
275
-
276
-        public int NewAgentId()
277
-        {
278
-            int id = 0;
279
-            if (_dbContext.Agents.Count() > 0)
280
-            {
281
-                id = _dbContext.Agents.Max(x => x.Id);
282
-            }
283
-            id += 1;
284
-            return id;
285
-        }
286
-
287
-        public int NewIndividualId()
288
-        {
289
-            int id = 0;
290
-            if (_dbContext.Individuals.Count() > 0)
291
-            {
292
-                id = _dbContext.Individuals.Max(x => x.Id);
293
-            }
294
-            id += 1;
295
-            return id;
296
-        }
297
-
298
-        public int NewUserId()
299
-        {
300
-            int id = 0;
301
-            if (_dbContext.Users.Count() > 0)
302
-            {
303
-                id = _dbContext.Users.Max(x => x.Id);
304
-            }
305
-            id += 1;
306
-            return id;
307
-        }
265
+        //public int NewAgencyId()
266
+        //{
267
+        //    int id = 0;
268
+        //    if (_dbContext.Agencies.Count() > 0)
269
+        //    {
270
+        //        id = _dbContext.Agencies.Max(x => x.Id);
271
+        //    }
272
+        //    id += 1;
273
+        //    return id;
274
+        //}
275
+
276
+        //public int NewAgentId()
277
+        //{
278
+        //    int id = 0;
279
+        //    if (_dbContext.Agents.Count() > 0)
280
+        //    {
281
+        //        id = _dbContext.Agents.Max(x => x.Id);
282
+        //    }
283
+        //    id += 1;
284
+        //    return id;
285
+        //}
286
+
287
+        //public int NewIndividualId()
288
+        //{
289
+        //    int id = 0;
290
+        //    if (_dbContext.Individuals.Count() > 0)
291
+        //    {
292
+        //        id = _dbContext.Individuals.Max(x => x.Id);
293
+        //    }
294
+        //    id += 1;
295
+        //    return id;
296
+        //}
297
+
298
+        //public int NewUserId()
299
+        //{
300
+        //    int id = 0;
301
+        //    if (_dbContext.Users.Count() > 0)
302
+        //    {
303
+        //        id = _dbContext.Users.Max(x => x.Id);
304
+        //    }
305
+        //    id += 1;
306
+        //    return id;
307
+        //}
308 308
 
309 309
         public SimplePersonDto UserDetails(int userId)
310 310
         {

+ 18
- 18
UnivateProperties_API/Repository/Users/UserRepository.cs Zobrazit soubor

@@ -42,20 +42,20 @@ namespace UnivateProperties_API.Repository.Users
42 42
 
43 43
         public void Insert(User item)
44 44
         {
45
-            item.Id = NewId();
45
+            //item.Id = NewId();
46 46
             _dbContext.Add(item);
47 47
             Save();
48 48
         }
49 49
 
50 50
         public void Insert(IEnumerable<User> item)
51 51
         {
52
-            int id = NewId();
53
-            foreach (var i in item)
54
-            {
55
-                i.Id = id;
56
-                _dbContext.Add(i);
57
-                id += 1;
58
-            }
52
+            //int id = NewId();
53
+            //foreach (var i in item)
54
+            //{
55
+            //    i.Id = id;
56
+                _dbContext.Add(item);
57
+            //    id += 1;
58
+            //}
59 59
             Save();
60 60
         }
61 61
 
@@ -135,15 +135,15 @@ namespace UnivateProperties_API.Repository.Users
135 135
             throw new NotImplementedException();
136 136
         }
137 137
 
138
-        public int NewId()
139
-        {
140
-            int id = 0;
141
-            if (_dbContext.Users.Count() > 0)
142
-            {
143
-                id = _dbContext.Users.Max(x => x.Id);
144
-            }
145
-            id += 1;
146
-            return id;
147
-        }
138
+        //public int NewId()
139
+        //{
140
+        //    int id = 0;
141
+        //    if (_dbContext.Users.Count() > 0)
142
+        //    {
143
+        //        id = _dbContext.Users.Max(x => x.Id);
144
+        //    }
145
+        //    id += 1;
146
+        //    return id;
147
+        //}
148 148
     }
149 149
 }

+ 1
- 1
UnivateProperties_API/appsettings.json Zobrazit soubor

@@ -9,7 +9,7 @@
9 9
   },
10 10
   "AllowedHosts": "*",
11 11
   "ConnectionStrings": {
12
-    "DefaultConnection": "Data Source=localhost;Initial Catalog=UniVateDemo;Persist Security Info=True;User Id=Provision;Password=What123!;Pooling=false;",
12
+    "DefaultConnection": "Data Source=192.168.0.219;Initial Catalog=UniVateDemo;Persist Security Info=True;User Id=Provision;Password=What123!;Pooling=false;",
13 13
     "TenderConnection": "http://www.unipoint-consoft.co.za/nph-srep.exe?cluvavail_test.sch&CLUB=LPA&RESORT=ALL&SUMMARY=N&HEAD=N"
14 14
   }
15 15
 }

Načítá se…
Zrušit
Uložit