Last change
on this file since de2baac was de2baac, checked in by DimitarSlezenkovski <dslezenkovski@…>, 4 years ago |
Add classes & interfaces for Repo
|
-
Property mode
set to
100644
|
File size:
890 bytes
|
Rev | Line | |
---|
[de2baac] | 1 | using FarmatikoData.FarmatikoRepoInterfaces;
|
---|
| 2 | using FarmatikoData.Models;
|
---|
| 3 | using Microsoft.EntityFrameworkCore;
|
---|
| 4 | using System;
|
---|
| 5 | using System.Collections.Generic;
|
---|
| 6 | using System.Linq;
|
---|
| 7 | using System.Text;
|
---|
| 8 |
|
---|
| 9 | namespace FarmatikoData.FarmatikoRepo
|
---|
| 10 | {
|
---|
| 11 | public class PandemicRepository : IPandemicRepository
|
---|
| 12 | {
|
---|
| 13 | private FarmatikoDataContext _context;
|
---|
| 14 |
|
---|
| 15 | public PandemicRepository(FarmatikoDataContext context)
|
---|
| 16 | {
|
---|
| 17 | _context = context;
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | public void Add(Pandemic pandemic)
|
---|
| 21 | {
|
---|
| 22 | _context.Pandemics.Add(pandemic);
|
---|
| 23 | _context.SaveChangesAsync();
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | public IEnumerable<Pandemic> GetAll()
|
---|
| 27 | {
|
---|
| 28 | return _context.Pandemics;
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | public void Remove(Pandemic pandemic)
|
---|
| 32 | {
|
---|
| 33 | _context.Pandemics.Remove(pandemic);
|
---|
| 34 | _context.SaveChangesAsync();
|
---|
| 35 | }
|
---|
| 36 | }
|
---|
| 37 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.