source: FarmatikoServices/Services/HealthFacilityService.cs@ c406ae5

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

Update Models, Repos, Services and Controllers

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[d2e69be]1using FarmatikoData;
2using FarmatikoData.FarmatikoRepoInterfaces;
3using FarmatikoData.Models;
[a55ef91]4using System;
[d2e69be]5using System.Linq;
[c406ae5]6using System.Threading.Tasks;
[d2e69be]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
[c406ae5]19 public async void Add(HealthFacilities healthFacility)
[d2e69be]20 {
[c406ae5]21 if (healthFacility != null)
22 await Task.Run(() => _healthFacilityRepository.Add(healthFacility));
23 else throw new Exception("Can't add, health facility is null");
[d2e69be]24 }
25
[c406ae5]26 public async Task<IQueryable<HealthFacilities>> GetAll()
[d2e69be]27 {
[c406ae5]28 return await Task.Run(() => _healthFacilityRepository.GetAll());
[d2e69be]29 }
[a55ef91]30
[c406ae5]31 public async void Remove(HealthFacilities healthFacility)
[a55ef91]32 {
[c406ae5]33 if (healthFacility != null)
34 await Task.Run(() => _healthFacilityRepository.Remove(healthFacility));
35 else throw new Exception("Can't Remove health facility is null");
36
[a55ef91]37 }
[d2e69be]38 }
39}
Note: See TracBrowser for help on using the repository browser.