source: FarmatikoServices/Services/HealthcareWorkerService.cs@ c73269d

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

Update & add service

  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[a55ef91]1using FarmatikoData.FarmatikoRepoInterfaces;
[d2e69be]2using FarmatikoData.Models;
[e42f61a]3using FarmatikoServices.FarmatikoServiceInterfaces;
[d2e69be]4using System;
[a55ef91]5using System.Linq;
[d2e69be]6
7namespace FarmatikoServices.Services
8{
9 public class HealthcareWorkerService : IHealthcareWorkerService
10 {
[e42f61a]11 private IHealthcareWorkerRepository _healthcareWorkerRepo;
12 public HealthcareWorkerService(IHealthcareWorkerRepository healthcareWorkerRepo)
[d2e69be]13 {
[e42f61a]14 _healthcareWorkerRepo = healthcareWorkerRepo;
[d2e69be]15 }
[e42f61a]16 public void Add(HealthcareWorkers healthcareWorker)
[d2e69be]17 {
[a55ef91]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 }
[d2e69be]28 }
29
[a55ef91]30 public IQueryable<HealthcareWorkers> GetAll()
[d2e69be]31 {
[e42f61a]32 return _healthcareWorkerRepo.GetAll();
[d2e69be]33 }
[a55ef91]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 }
[d2e69be]48 }
49}
Note: See TracBrowser for help on using the repository browser.