Last change
on this file since c406ae5 was c406ae5, checked in by DimitarSlezenkovski <dslezenkovski@…>, 4 years ago |
Update Models, Repos, Services and Controllers
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | using FarmatikoData.FarmatikoRepoInterfaces;
|
---|
2 | using FarmatikoData.Models;
|
---|
3 | using FarmatikoServices.FarmatikoServiceInterfaces;
|
---|
4 | using System;
|
---|
5 | using System.Linq;
|
---|
6 | using System.Threading.Tasks;
|
---|
7 |
|
---|
8 | namespace FarmatikoServices.Services
|
---|
9 | {
|
---|
10 | public class PandemicService : IPandemicService
|
---|
11 | {
|
---|
12 | private IPandemicRepository _pandemicRepository;
|
---|
13 | public PandemicService(IPandemicRepository pandemicRepository)
|
---|
14 | {
|
---|
15 | _pandemicRepository = pandemicRepository;
|
---|
16 | }
|
---|
17 |
|
---|
18 | public async void Add(Pandemic pandemic)
|
---|
19 | {
|
---|
20 | if (pandemic != null)
|
---|
21 | await Task.Run(() => _pandemicRepository.Add(pandemic));
|
---|
22 | else throw new Exception("Can't add pandemic is null.");
|
---|
23 | }
|
---|
24 |
|
---|
25 | public async Task<IQueryable<Pandemic>> GetAll()
|
---|
26 | {
|
---|
27 | return await Task.Run(() => _pandemicRepository.GetAll());
|
---|
28 | }
|
---|
29 |
|
---|
30 | public async void Remove(Pandemic pandemic)
|
---|
31 | {
|
---|
32 | if (pandemic != null)
|
---|
33 | await Task.Run(() => _pandemicRepository.Remove(pandemic));
|
---|
34 | else throw new Exception("Can't remove, pandemic is null.");
|
---|
35 | }
|
---|
36 | }
|
---|
37 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.