source: FarmatikoServices/Services/HealthFacilityService.cs@ c406ae5

Last change on this file since c406ae5 was c406ae5, checked in by DimitarSlezenkovski <dslezenkovski@…>, 4 years ago

Update Models, Repos, Services and Controllers

  • Property mode set to 100644
File size: 1.2 KB
Line 
1using FarmatikoData;
2using FarmatikoData.FarmatikoRepoInterfaces;
3using FarmatikoData.Models;
4using System;
5using System.Linq;
6using System.Threading.Tasks;
7
8namespace FarmatikoServices
9{
10 public class HealthFacilityService : IHealthFacilityService
11 {
12 private IHealthFacilityRepository _healthFacilityRepository;
13
14 public HealthFacilityService(IHealthFacilityRepository healthFacilityRepository)
15 {
16 _healthFacilityRepository = healthFacilityRepository;
17 }
18
19 public async void Add(HealthFacilities healthFacility)
20 {
21 if (healthFacility != null)
22 await Task.Run(() => _healthFacilityRepository.Add(healthFacility));
23 else throw new Exception("Can't add, health facility is null");
24 }
25
26 public async Task<IQueryable<HealthFacilities>> GetAll()
27 {
28 return await Task.Run(() => _healthFacilityRepository.GetAll());
29 }
30
31 public async void Remove(HealthFacilities healthFacility)
32 {
33 if (healthFacility != null)
34 await Task.Run(() => _healthFacilityRepository.Remove(healthFacility));
35 else throw new Exception("Can't Remove health facility is null");
36
37 }
38 }
39}
Note: See TracBrowser for help on using the repository browser.