source: FarmatikoServices/Services/HealthFacilityService.cs@ 58fa654

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

Update & add service

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