source: FarmatikoData/FarmatikoRepo/MedicineListRepository.cs@ 37c8d1d

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

Add FarmatikoRepository and FarmatikoServices

  • Property mode set to 100644
File size: 1.1 KB
Line 
1using FarmatikoData.Models;
2using Microsoft.EntityFrameworkCore;
3using System;
4using System.Collections.Generic;
5using System.Linq;
6using System.Text;
7
8namespace 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.