source: FarmatikoData/FarmatikoRepo/PandemicRepository.cs@ a55ef91

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: 806 bytes
Line 
1using FarmatikoData.FarmatikoRepoInterfaces;
2using FarmatikoData.Models;
3using System.Linq;
4
5namespace FarmatikoData.FarmatikoRepo
6{
7 public class PandemicRepository : IPandemicRepository
8 {
9 private FarmatikoDataContext _context;
10
11 public PandemicRepository(FarmatikoDataContext context)
12 {
13 _context = context;
14 }
15
16 public void Add(Pandemic pandemic)
17 {
18 _context.Pandemics.Add(pandemic);
19 _context.SaveChangesAsync();
20 }
21
22 public IQueryable<Pandemic> GetAll()
23 {
24 return _context.Pandemics.OrderBy(x => x.Name);
25 }
26
27 public void Remove(Pandemic pandemic)
28 {
29 _context.Pandemics.Remove(pandemic);
30 _context.SaveChangesAsync();
31 }
32 }
33}
Note: See TracBrowser for help on using the repository browser.