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
|
Rev | Line | |
---|
[4e72684] | 1 | using FarmatikoData.FarmatikoRepoInterfaces;
|
---|
| 2 | using FarmatikoData.Models;
|
---|
| 3 | using FarmatikoServices.FarmatikoServiceInterfaces;
|
---|
| 4 | using System;
|
---|
[a55ef91] | 5 | using System.Linq;
|
---|
[c406ae5] | 6 | using System.Threading.Tasks;
|
---|
[4e72684] | 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 |
|
---|
[c406ae5] | 18 | public async void Add(Pandemic pandemic)
|
---|
[4e72684] | 19 | {
|
---|
[c406ae5] | 20 | if (pandemic != null)
|
---|
| 21 | await Task.Run(() => _pandemicRepository.Add(pandemic));
|
---|
| 22 | else throw new Exception("Can't add pandemic is null.");
|
---|
[4e72684] | 23 | }
|
---|
| 24 |
|
---|
[c406ae5] | 25 | public async Task<IQueryable<Pandemic>> GetAll()
|
---|
[4e72684] | 26 | {
|
---|
[c406ae5] | 27 | return await Task.Run(() => _pandemicRepository.GetAll());
|
---|
[4e72684] | 28 | }
|
---|
| 29 |
|
---|
[c406ae5] | 30 | public async void Remove(Pandemic pandemic)
|
---|
[4e72684] | 31 | {
|
---|
[c406ae5] | 32 | if (pandemic != null)
|
---|
| 33 | await Task.Run(() => _pandemicRepository.Remove(pandemic));
|
---|
| 34 | else throw new Exception("Can't remove, pandemic is null.");
|
---|
[4e72684] | 35 | }
|
---|
| 36 | }
|
---|
| 37 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.