source: FarmatikoServices/Services/HealthFacilityService.cs@ a55ef91

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

Update & add service

  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[d2e69be]1using FarmatikoData;
2using FarmatikoData.FarmatikoRepoInterfaces;
3using FarmatikoData.Models;
[a55ef91]4using System;
[d2e69be]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 {
[a55ef91]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 }
[d2e69be]30 }
31
[a55ef91]32 public IQueryable<HealthFacilities> GetAll()
[d2e69be]33 {
34 return _healthFacilityRepository.GetAll();
35 }
[a55ef91]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 }
[d2e69be]50 }
51}
Note: See TracBrowser for help on using the repository browser.