Line | |
---|
1 | using FarmatikoData.Models;
|
---|
2 | using Microsoft.EntityFrameworkCore;
|
---|
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 MedicineListRepository : IMedicineListRepository
|
---|
11 | {
|
---|
12 | private FarmatikoDataContext _context;
|
---|
13 | public MedicineListRepository(FarmatikoDataContext context)
|
---|
14 | {
|
---|
15 | _context = context;
|
---|
16 | }
|
---|
17 | public void Add(MedicineList medicineList)
|
---|
18 | {
|
---|
19 | _context.MedicineLists.Add(medicineList);
|
---|
20 | _context.SaveChangesAsync();
|
---|
21 | }
|
---|
22 |
|
---|
23 | public MedicineList CheckMedicine(string Name)
|
---|
24 | {
|
---|
25 | return (MedicineList)_context.MedicineLists.Where(medicineList => medicineList.Medicine.Name.Equals(Name));
|
---|
26 | }
|
---|
27 |
|
---|
28 | public MedicineList GetAll()
|
---|
29 | {
|
---|
30 | return (MedicineList)_context.MedicineLists.Include(list => list.Medicine).Include(list => list.HasMedicine);
|
---|
31 | }
|
---|
32 |
|
---|
33 | public void Remove(MedicineList medicineList)
|
---|
34 | {
|
---|
35 | //throw new NotImplementedException();
|
---|
36 | //Implement later
|
---|
37 | }
|
---|
38 | }
|
---|
39 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.