Changeset e0cdea2 for FarmatikoData/FarmatikoRepo/PHRepo.cs
- Timestamp:
- 02/08/21 16:39:25 (4 years ago)
- Branches:
- master
- Children:
- 8eb1e21, dae4cde
- Parents:
- 0a694bb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
FarmatikoData/FarmatikoRepo/PHRepo.cs
r0a694bb re0cdea2 41 41 public async Task UpdatePharmacyHead(PharmacyHead pharmacyHead) 42 42 { 43 var Phead = await _context.PharmacyHeads.Where(x => x.Email == pharmacyHead.Email).FirstOrDefaultAsync();44 var EditedPHead = await _context.PharmacyHeads. AsNoTracking<PharmacyHead>().Where(x => x.Email == pharmacyHead.Email).FirstOrDefaultAsync();43 var user = await _context.Users.Where(x => x.Email == pharmacyHead.Email).FirstOrDefaultAsync(); 44 var EditedPHead = await _context.PharmacyHeads.Where(x => x.Email.Equals(pharmacyHead.Email)).FirstOrDefaultAsync(); 45 45 46 if (!EditedPHead.Email.Equals(pharmacyHead.Email)) 46 /*if (!EditedPHead.Email.Equals(pharmacyHead.Email) && !user.Email.Equals(pharmacyHead.Email)) 47 { 47 48 EditedPHead.Email = pharmacyHead.Email; 49 user.Email = pharmacyHead.Email; 50 }*/ 48 51 49 if (!EditedPHead.Name.Equals(pharmacyHead.Name)) 52 if (!EditedPHead.Name.Equals(pharmacyHead.Name) || !user.Name.Equals(pharmacyHead.Name)) 53 { 50 54 EditedPHead.Name = pharmacyHead.Name; 55 user.Name = pharmacyHead.Name; 56 } 51 57 52 if (!EditedPHead.Password.Equals(pharmacyHead.Password)) 58 if (!EditedPHead.Password.Equals(pharmacyHead.Password) || !user.Password.Equals(pharmacyHead.Password)) 59 { 53 60 EditedPHead.Password = pharmacyHead.Password; 61 user.Password = pharmacyHead.Password; 62 } 63 /*if (EditedPHead.Pharmacies != null) 64 { 65 if (EditedPHead.Pharmacies.Count() > 0) 66 if (!EditedPHead.Pharmacies.Equals(pharmacyHead.Pharmacies)) 67 EditedPHead.Pharmacies = pharmacyHead.Pharmacies; 68 } 69 if (EditedPHead.Medicines != null) 70 { 71 if (EditedPHead.Medicines.Count() > 0) 72 { 73 if (!EditedPHead.Medicines.Equals(pharmacyHead.Medicines)) 74 EditedPHead.Medicines = pharmacyHead.Medicines; 75 76 } 77 78 }*/ 54 79 55 if (!EditedPHead.Pharmacies.Equals(pharmacyHead.Pharmacies)) 56 EditedPHead.Pharmacies = pharmacyHead.Pharmacies; 57 58 if (!EditedPHead.Medicines.Equals(pharmacyHead.Medicines)) 59 EditedPHead.Medicines = pharmacyHead.Medicines; 60 61 await _context.SaveChangesAsync(); 80 _context.SaveChanges(); 62 81 } 63 82 public async Task ClaimPharmacy(RequestPharmacyHead pharmacy) 64 83 { 84 var phead = _context.PharmacyHeads.Where(x => x.Email.Equals(pharmacy.Head.Email)).FirstOrDefault(); 85 pharmacy.Head = phead; 65 86 await _context.PHRequests.AddAsync(pharmacy); 66 87 await _context.SaveChangesAsync();
Note:
See TracChangeset
for help on using the changeset viewer.