source: FarmatikoData/FarmatikoRepo/HealthFacilityRepository.cs@ a55ef91

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

Update & add service

  • Property mode set to 100644
File size: 943 bytes
RevLine 
[37c8d1d]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);
[a55ef91]19 _context.SaveChanges();
[37c8d1d]20 }
21
[a55ef91]22 public IQueryable<HealthFacilities> GetAll()
[37c8d1d]23 {
[a55ef91]24 return _context.HealthFacilities.OrderBy(x => x.Name);
[37c8d1d]25 }
26
[a55ef91]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 }
[37c8d1d]32 }
33}
Note: See TracBrowser for help on using the repository browser.