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.3 KB
|
Line | |
---|
1 | using FarmatikoData.FarmatikoRepoInterfaces;
|
---|
2 | using FarmatikoData.Models;
|
---|
3 | using FarmatikoServices.FarmatikoServiceInterfaces;
|
---|
4 | using System;
|
---|
5 | using System.Linq;
|
---|
6 |
|
---|
7 | namespace FarmatikoServices.Services
|
---|
8 | {
|
---|
9 | public class PandemicService : IPandemicService
|
---|
10 | {
|
---|
11 | private IPandemicRepository _pandemicRepository;
|
---|
12 | public PandemicService(IPandemicRepository pandemicRepository)
|
---|
13 | {
|
---|
14 | _pandemicRepository = pandemicRepository;
|
---|
15 | }
|
---|
16 |
|
---|
17 | public void Add(Pandemic pandemic)
|
---|
18 | {
|
---|
19 | try
|
---|
20 | {
|
---|
21 | if (pandemic != null)
|
---|
22 | {
|
---|
23 | _pandemicRepository.Add(pandemic);
|
---|
24 | }
|
---|
25 | }
|
---|
26 | catch (Exception e)
|
---|
27 | {
|
---|
28 | e = new Exception("Can't add pandemic is null.");
|
---|
29 | throw e;
|
---|
30 | }
|
---|
31 | }
|
---|
32 |
|
---|
33 | public IQueryable<Pandemic> GetAll()
|
---|
34 | {
|
---|
35 | return _pandemicRepository.GetAll();
|
---|
36 | }
|
---|
37 |
|
---|
38 | public void Remove(Pandemic pandemic)
|
---|
39 | {
|
---|
40 | try
|
---|
41 | {
|
---|
42 | if (pandemic != null)
|
---|
43 | _pandemicRepository.Remove(pandemic);
|
---|
44 | }
|
---|
45 | catch (Exception e)
|
---|
46 | {
|
---|
47 | e = new Exception("Can't remove, pandemic is null.");
|
---|
48 | }
|
---|
49 | }
|
---|
50 | }
|
---|
51 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.