Changeset a55ef91 for FarmatikoServices/Services/PharmacyService.cs
- Timestamp:
- 07/31/20 10:15:02 (4 years ago)
- Branches:
- master
- Children:
- d8fafb8
- Parents:
- 4e72684
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
FarmatikoServices/Services/PharmacyService.cs
r4e72684 ra55ef91 2 2 using FarmatikoData.Models; 3 3 using FarmatikoServices.FarmatikoServiceInterfaces; 4 using System; 4 5 using System.Collections.Generic; 6 using System.Linq; 5 7 6 8 namespace FarmatikoServices.Services … … 15 17 public void Add(Pharmacy pharmacy) 16 18 { 17 if(pharmacy != null)19 try 18 20 { 19 _pharmacyRepository.Add(pharmacy); 21 if (pharmacy != null) 22 { 23 _pharmacyRepository.Add(pharmacy); 24 } 20 25 } 26 catch (Exception e) 27 { 28 e = new Exception("Can't add, pharmacy has null value."); 29 throw e; 30 } 31 21 32 } 22 33 23 public I Enumerable<Pharmacy> GetAll()34 public IQueryable<Pharmacy> GetAll() 24 35 { 25 36 return _pharmacyRepository.GetAll(); … … 33 44 public void Remove(Pharmacy pharmacy) 34 45 { 35 _pharmacyRepository.Remove(pharmacy); 46 try 47 { 48 if (pharmacy != null) 49 _pharmacyRepository.Remove(pharmacy); 50 } 51 catch (Exception e) 52 { 53 e = new Exception("Can't remove, pharmacy has null value."); 54 throw e; 55 } 36 56 } 37 57 38 58 public void UpdatePharmacy(Pharmacy pharmacy, string Name) 39 59 { 40 if(pharmacy != null && Name != null)60 try 41 61 { 42 _pharmacyRepository.UpdatePharmacy(pharmacy, Name); 62 if (pharmacy != null && Name != null) 63 { 64 _pharmacyRepository.UpdatePharmacy(pharmacy, Name); 65 } 43 66 } 67 catch (Exception e) 68 { 69 e = new Exception("Can not update pharmacy, has null value."); 70 throw e; 71 } 72 44 73 } 45 74 }
Note:
See TracChangeset
for help on using the changeset viewer.