Changeset 7d80751
- Timestamp:
- 01/26/21 13:55:15 (4 years ago)
- Branches:
- master
- Children:
- 7520f88
- Parents:
- db484c9
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
FarmatikoData/FarmatikoDataContext.cs
rdb484c9 r7d80751 38 38 .ToTable("PHRequests"); 39 39 40 modelBuilder.Entity<Medicine>()40 /*modelBuilder.Entity<Medicine>() 41 41 .Property(x => x.Id) 42 42 .HasIdentityOptions(startValue: 1); … … 56 56 modelBuilder.Entity<RequestPharmacyHead>() 57 57 .Property(x => x.Id) 58 .HasIdentityOptions(startValue: 1); 58 .HasIdentityOptions(startValue: 1);*/ 59 59 60 60 /*modelBuilder.Entity<User>() -
FarmatikoData/FarmatikoRepo/Repository.cs
rdb484c9 r7d80751 145 145 public async Task AddPharmacyHead(PharmacyHead pharmacyHead) 146 146 { 147 await _context.PharmacyHeads.AddAsync(pharmacyHead); 148 _context.SaveChanges(); 147 pharmacyHead.Id = 0; 148 if (pharmacyHead.Id == 0) 149 { 150 var pheads = await _context.PharmacyHeads.ToListAsync(); 151 if (!pheads.Select(x => x.Equals(pharmacyHead)).FirstOrDefault()) 152 { 153 await _context.PharmacyHeads.AddAsync(pharmacyHead); 154 await _context.SaveChangesAsync(); 155 } 156 } 149 157 } 150 158 … … 273 281 public async Task AddUser(User user) 274 282 { 275 await _context.Users.AddAsync(user); 276 await _context.SaveChangesAsync(); 283 if (user.Id == 0) 284 { 285 var users = await _context.Users.ToListAsync(); 286 if (!users.Select(x => x.Equals(user)).FirstOrDefault()) 287 { 288 await _context.Users.AddAsync(user); 289 await _context.SaveChangesAsync(); 290 } 291 } 277 292 } 278 293 } -
FarmatikoServices/Services/PHService.cs
rdb484c9 r7d80751 195 195 foreach (var med in Medicines) 196 196 { 197 if (Phead.Medicines == null || Phead.Medicines.Count() == 0) 198 break; 197 199 var PHMObj = Phead.Medicines.Where(x => x.MedicineId == med.Id).SingleOrDefault(); 198 200 if (PHMObj == null)
Note:
See TracChangeset
for help on using the changeset viewer.