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