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
|
Rev | Line | |
---|
[d2e69be] | 1 | using FarmatikoData;
|
---|
| 2 | using FarmatikoData.FarmatikoRepoInterfaces;
|
---|
| 3 | using FarmatikoData.Models;
|
---|
[a55ef91] | 4 | using System;
|
---|
[d2e69be] | 5 | using System.Linq;
|
---|
[c406ae5] | 6 | using System.Threading.Tasks;
|
---|
[d2e69be] | 7 |
|
---|
| 8 | namespace 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.