Changeset 6f203af for FarmatikoServices/Services/PHService.cs
- Timestamp:
- 10/28/20 22:06:48 (4 years ago)
- Branches:
- master
- Children:
- 993189e
- Parents:
- 1454207
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
FarmatikoServices/Services/PHService.cs
r1454207 r6f203af 18 18 } 19 19 20 public async Task ClaimPharmacy(RequestPharmacyHead pharmacy)20 public async Task<bool> ClaimPharmacy(RequestPharmacyHead pharmacy) 21 21 { 22 await _iPHRepo.ClaimPharmacy(pharmacy); 22 if (pharmacy != null) 23 { 24 await _iPHRepo.ClaimPharmacy(pharmacy); 25 return true; 26 } 27 return false; 23 28 } 24 29 25 public Task<IQueryable<PharmacyHead>> GetPharmacyHeadInfo(string Token)30 public async Task<PharmacyHead> GetPharmacyHeadByIdAsync(int id) 26 31 { 27 throw new NotImplementedException(); 32 PharmacyHead Phead = null; 33 if (id >= 0) 34 Phead = await _iPHRepo.GetPharmacyHeadByIdAsync(id); 35 if (Phead != null) 36 return Phead; 37 throw new Exception("No data found."); 38 } 39 40 public async Task<IEnumerable<PharmacyHead>> GetPharmacyHeadInfo(string Token) 41 { 42 var PHeads = await _iPHRepo.GetPharmacyHeadInfo(); 43 if (PHeads != null) 44 return PHeads; 45 throw new Exception("No Pharmacy heads found."); 28 46 } 29 47 30 48 public async Task<int> Login(PharmacyHead pharmacyHead) 31 49 { 32 var PHead = await Task.Run(() => _iPHRepo.GetPharmacyHead(pharmacyHead));50 var PHead = await _iPHRepo.GetPharmacyHeadByIdAsync(pharmacyHead.Id); 33 51 if (PHead.Password.Equals(pharmacyHead.Password)) 34 52 return PHead.Id; … … 43 61 else throw new Exception("PharmacyHead has a null value."); 44 62 } 63 public async Task<bool> Add(PharmacyHead pharmacyHead) 64 { 65 if (pharmacyHead != null) 66 { 67 await _iPHRepo.Add(pharmacyHead); 68 return true; 69 } 70 return false; 71 } 72 73 public async Task<bool> Remove(int id) 74 { 75 PharmacyHead Phead = await _iPHRepo.GetPharmacyHeadByIdAsync(id); 76 if (Phead != null && id >= 0) 77 { 78 Phead.DeletedOn = DateTime.UtcNow; 79 await _iPHRepo.Remove(Phead); 80 return true; 81 } 82 return false; 83 } 84 85 public async Task<bool> RemoveClaimingRequest(int id) 86 { 87 if (id >= 0) 88 { 89 await _iPHRepo.RemoveClaimingRequest(id); 90 return true; 91 } 92 return false; 93 } 45 94 } 46 95 }
Note:
See TracChangeset
for help on using the changeset viewer.