- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
FarmatikoServices/Services/HealthFacilityService.cs
ra55ef91 rc406ae5 4 4 using System; 5 5 using System.Linq; 6 using System.Threading.Tasks; 6 7 7 8 namespace FarmatikoServices … … 16 17 } 17 18 18 public void Add(HealthFacilities healthFacility)19 public async void Add(HealthFacilities healthFacility) 19 20 { 20 try 21 { 22 if (healthFacility != null) 23 _healthFacilityRepository.Add(healthFacility); 24 } 25 catch (Exception e) 26 { 27 e = new Exception("Can't Add health facility is null"); 28 throw e; 29 } 21 if (healthFacility != null) 22 await Task.Run(() => _healthFacilityRepository.Add(healthFacility)); 23 else throw new Exception("Can't add, health facility is null"); 30 24 } 31 25 32 public IQueryable<HealthFacilities> GetAll()26 public async Task<IQueryable<HealthFacilities>> GetAll() 33 27 { 34 return _healthFacilityRepository.GetAll();28 return await Task.Run(() => _healthFacilityRepository.GetAll()); 35 29 } 36 30 37 public void Remove(HealthFacilities healthFacility)31 public async void Remove(HealthFacilities healthFacility) 38 32 { 39 try 40 { 41 if (healthFacility != null) 42 _healthFacilityRepository.Remove(healthFacility); 43 } 44 catch(Exception e) 45 { 46 e = new Exception("Can't Remove health facility is null"); 47 throw e; 48 } 33 if (healthFacility != null) 34 await Task.Run(() => _healthFacilityRepository.Remove(healthFacility)); 35 else throw new Exception("Can't Remove health facility is null"); 36 49 37 } 50 38 }
Note:
See TracChangeset
for help on using the changeset viewer.