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