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