Changeset 8eb1e21 for FarmatikoData/FarmatikoRepo
- Timestamp:
- 02/11/21 03:49:55 (4 years ago)
- Branches:
- master
- Children:
- 6e6f04b
- Parents:
- e0cdea2
- Location:
- FarmatikoData/FarmatikoRepo
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
FarmatikoData/FarmatikoRepo/PHRepo.cs
re0cdea2 r8eb1e21 61 61 user.Password = pharmacyHead.Password; 62 62 } 63 /*if (EditedPHead.Pharmacies != null)63 foreach(var pharmacy in pharmacyHead.Pharmacies) 64 64 { 65 if (EditedPHead.Pharmacies.Count() > 0) 66 if (!EditedPHead.Pharmacies.Equals(pharmacyHead.Pharmacies)) 67 EditedPHead.Pharmacies = pharmacyHead.Pharmacies; 65 if (!EditedPHead.Pharmacies.Contains(pharmacy)) 66 { 67 pharmacy.PheadId = EditedPHead.Id; 68 pharmacy.PharmacyHead = EditedPHead; 69 EditedPHead.Pharmacies.Add(pharmacy); 70 } 68 71 } 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 }*/ 79 72 _context.Entry(EditedPHead).State = EntityState.Modified; 73 80 74 _context.SaveChanges(); 81 75 } … … 153 147 public PharmacyHead GetPharmacyHead(string head) 154 148 { 155 var phead = _context.PharmacyHeads.Where(x => x.Email.Equals(head)). FirstOrDefault();149 var phead = _context.PharmacyHeads.Where(x => x.Email.Equals(head)).Include(x => x.Pharmacies).FirstOrDefault(); 156 150 return phead; 157 151 } -
FarmatikoData/FarmatikoRepo/Repository.cs
re0cdea2 r8eb1e21 270 270 public async Task RemovePharmacyHead(int Id) 271 271 { 272 var PHead = await _context.PharmacyHeads.Where(x => x.Id == Id). FirstOrDefaultAsync();272 var PHead = await _context.PharmacyHeads.Where(x => x.Id == Id).Include(x => x.Pharmacies).Include(x => x.Medicines).FirstOrDefaultAsync(); 273 273 var user = await _context.Users.Where(x => x.Email.Equals(PHead.Email)).FirstOrDefaultAsync(); 274 var PHreqs = await _context.PHRequests.Where(x => x.Head.Id.Equals(PHead.Id)).FirstOrDefaultAsync(); 275 PHead.Pharmacies.Select(x => x.PheadId = null); 276 //PHead.Pharmacies.Select(x => x.PharmacyHead = null); 277 _context.PHRequests.Remove(PHreqs); 274 278 _context.PharmacyHeads.Remove(PHead); 275 279 _context.Users.Remove(user);
Note:
See TracChangeset
for help on using the changeset viewer.