source: FarmatikoData/FarmatikoRepo/HealthcareWorkerRepository.cs@ a55ef91

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

Update & add service

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