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.3 KB
|
Rev | Line | |
---|
[4e72684] | 1 | using FarmatikoData.FarmatikoRepoInterfaces;
|
---|
| 2 | using FarmatikoData.Models;
|
---|
| 3 | using FarmatikoServices.FarmatikoServiceInterfaces;
|
---|
| 4 | using System;
|
---|
[a55ef91] | 5 | using System.Linq;
|
---|
[4e72684] | 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 | {
|
---|
[a55ef91] | 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 | }
|
---|
[4e72684] | 31 | }
|
---|
| 32 |
|
---|
[a55ef91] | 33 | public IQueryable<Pandemic> GetAll()
|
---|
[4e72684] | 34 | {
|
---|
| 35 | return _pandemicRepository.GetAll();
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | public void Remove(Pandemic pandemic)
|
---|
| 39 | {
|
---|
[a55ef91] | 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 | }
|
---|
[4e72684] | 49 | }
|
---|
| 50 | }
|
---|
| 51 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.