Ignore:
Timestamp:
02/11/21 03:49:55 (22 months ago)
Author:
Dimitar Slezenkovski <dslezenkovski@…>
Branches:
master
Children:
6e6f04b
Parents:
e0cdea2
Message:

Fix delete pharmacy head method.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • FarmatikoData/FarmatikoRepo/Repository.cs

    re0cdea2 r8eb1e21  
    270270        public async Task RemovePharmacyHead(int Id)
    271271        {
    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();
    273273            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);
    274278            _context.PharmacyHeads.Remove(PHead);
    275279            _context.Users.Remove(user);
Note: See TracChangeset for help on using the changeset viewer.