Last change
on this file since 4e72684 was 4e72684, checked in by DimitarSlezenkovski <dslezenkovski@…>, 4 years ago |
Add services
|
-
Property mode
set to
100644
|
File size:
1.6 KB
|
Line | |
---|
1 | using FarmatikoData.FarmatikoRepoInterfaces;
|
---|
2 | using FarmatikoData.Models;
|
---|
3 | using System;
|
---|
4 | using System.Collections.Generic;
|
---|
5 | using System.Linq;
|
---|
6 | using System.Text;
|
---|
7 |
|
---|
8 | namespace FarmatikoData.FarmatikoRepo
|
---|
9 | {
|
---|
10 | public class PharmacyHeadRepository : IPharmacyHeadRepository
|
---|
11 | {
|
---|
12 | private FarmatikoDataContext _context;
|
---|
13 |
|
---|
14 | public PharmacyHeadRepository(FarmatikoDataContext context)
|
---|
15 | {
|
---|
16 | _context = context;
|
---|
17 | }
|
---|
18 |
|
---|
19 | public void Add(PharmacyHead pharmacyHead)
|
---|
20 | {
|
---|
21 | _context.PharmacyHeads.Add(pharmacyHead);
|
---|
22 | _context.SaveChangesAsync();
|
---|
23 | }
|
---|
24 |
|
---|
25 | public IQueryable<PharmacyHead> GetAllPharmacies(string NameOfPharmacyHeads)
|
---|
26 | {
|
---|
27 | return _context.PharmacyHeads
|
---|
28 | .Where(pharmacyHead => pharmacyHead.Name.Contains(NameOfPharmacyHeads))
|
---|
29 | .OrderBy(x => x.Name);
|
---|
30 | }
|
---|
31 | //Not needed
|
---|
32 | public IQueryable<PharmacyHead> GetPharmacyByName(string Name)
|
---|
33 | {
|
---|
34 | return _context.PharmacyHeads.Where(pharmacyHead => pharmacyHead.Name.Equals(Name));
|
---|
35 | }
|
---|
36 |
|
---|
37 | public IQueryable<MedicineList> GetPharmacyMedicines(string NameOfPharmacy)
|
---|
38 | {
|
---|
39 |
|
---|
40 | IQueryable<MedicineList> Pharmacy = (IQueryable<MedicineList>)_context.PharmacyHeads.Where(x => x.Name.Equals(NameOfPharmacy));
|
---|
41 |
|
---|
42 | return Pharmacy;
|
---|
43 | }
|
---|
44 |
|
---|
45 | public void Remove(PharmacyHead pharmacyHead, string Name)
|
---|
46 | {
|
---|
47 | var phead = (PharmacyHead)_context.PharmacyHeads.Where(phead => phead.Name.Equals(Name));
|
---|
48 | _context.PharmacyHeads.Remove(phead);
|
---|
49 | _context.SaveChangesAsync();
|
---|
50 | }
|
---|
51 | }
|
---|
52 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.