Line | |
---|
1 | using FarmatikoData.FarmatikoRepoInterfaces;
|
---|
2 | using FarmatikoData.Models;
|
---|
3 | using System;
|
---|
4 | using System.Linq;
|
---|
5 | using System.Collections.Generic;
|
---|
6 | using System.Text;
|
---|
7 | using Microsoft.EntityFrameworkCore;
|
---|
8 |
|
---|
9 | namespace FarmatikoData.FarmatikoRepo
|
---|
10 | {
|
---|
11 | public class HealthcareWorkersRepository : IHealthcareWorkersRepository
|
---|
12 | {
|
---|
13 |
|
---|
14 | private FarmatikoDataContext _context;
|
---|
15 |
|
---|
16 | public HealthcareWorkersRepository(FarmatikoDataContext context)
|
---|
17 | {
|
---|
18 | _context = context;
|
---|
19 | }
|
---|
20 |
|
---|
21 | public void Add(HealthcareWorkers HealthcareWorker)
|
---|
22 | {
|
---|
23 | _context.Add(HealthcareWorker);
|
---|
24 | _context.SaveChangesAsync();
|
---|
25 | }
|
---|
26 |
|
---|
27 | public IEnumerable<HealthcareWorkers> GetAll()
|
---|
28 | {
|
---|
29 | return _context.HealthcareWorkers;
|
---|
30 | }
|
---|
31 |
|
---|
32 | public ICollection<HealthcareWorkers> GetByBranch(string Branch)
|
---|
33 | {
|
---|
34 | return (ICollection<HealthcareWorkers>)_context.HealthcareWorkers.Where(healthcareWorker => healthcareWorker.Branch == Branch);
|
---|
35 | }
|
---|
36 |
|
---|
37 | public ICollection<HealthcareWorkers> GetByFacility(HealthFacilities HealthFacility)
|
---|
38 | {
|
---|
39 | return (ICollection<HealthcareWorkers>)_context.HealthcareWorkers.Where(Facility => Facility.Facility.Equals(HealthFacility));
|
---|
40 | }
|
---|
41 |
|
---|
42 | public HealthcareWorkers GetByName(string Name)
|
---|
43 | {
|
---|
44 | return (HealthcareWorkers)_context.HealthcareWorkers.Where(healthcareWorker => healthcareWorker.Name == Name);
|
---|
45 | }
|
---|
46 | }
|
---|
47 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.