source: FarmatikoData/FarmatikoRepo/HealthFacilityRepository.cs@ d8fafb8

Last change on this file since d8fafb8 was a55ef91, checked in by DimitarSlezenkovski <dslezenkovski@…>, 4 years ago

Update & add service

  • Property mode set to 100644
File size: 943 bytes
Line 
1using FarmatikoData.FarmatikoRepoInterfaces;
2using System.Linq;
3using FarmatikoData.Models;
4
5namespace FarmatikoData.FarmatikoRepo
6{
7 public class HealthFacilityRepository : IHealthFacilityRepository
8 {
9 private FarmatikoDataContext _context;
10
11 public HealthFacilityRepository(FarmatikoDataContext context)
12 {
13 _context = context;
14 }
15
16 public void Add(HealthFacilities healthFacility)
17 {
18 _context.Add(healthFacility);
19 _context.SaveChanges();
20 }
21
22 public IQueryable<HealthFacilities> GetAll()
23 {
24 return _context.HealthFacilities.OrderBy(x => x.Name);
25 }
26
27 public void Remove(HealthFacilities healthFacility)
28 {
29 var facility = _context.HealthFacilities.Where(x => x.Name.Equals(healthFacility.Name));
30 _context.HealthFacilities.Remove((HealthFacilities)facility);
31 }
32 }
33}
Note: See TracBrowser for help on using the repository browser.