source: FarmatikoServices/Services/HealthcareWorkerService.cs@ a55ef91

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

Update & add service

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