- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
FarmatikoData/FarmatikoRepo/MedicineListRepository.cs
rc406ae5 ra55ef91 29 29 public IQueryable<MedicineList> GetAll() 30 30 { 31 return _context.MedicineLists.Take(50).Select(x => new MedicineList 32 { 33 Medicine = x.Medicine, 34 HasMedicine = x.HasMedicine 35 }).OrderBy(x => x.Medicine.Name); 31 return _context.MedicineLists.OrderBy(x => x.Medicine.Name); 36 32 } 37 33 38 34 public ICollection<MedicineList> GetByManufacturer(string Manufacturer) 39 35 { 40 return (ICollection<MedicineList>)_context.MedicineLists .Take(50)36 return (ICollection<MedicineList>)_context.MedicineLists 41 37 .Where(x => x.Medicine.Manufacturer.Contains(Manufacturer)) 42 .Select(x => new MedicineList43 {44 Medicine = x.Medicine,45 HasMedicine = x.HasMedicine46 })47 38 .OrderBy(x => x.Medicine.Name) 48 39 .Cast<ICollection<MedicineList>>(); … … 50 41 public ICollection<MedicineList> GetByName(string Name) 51 42 { 52 return (ICollection<MedicineList>)_context.MedicineLists .Take(50)43 return (ICollection<MedicineList>)_context.MedicineLists 53 44 .Where(x => x.Medicine.Name.Contains(Name)) 54 .Select(x => new MedicineList55 {56 Medicine = x.Medicine,57 HasMedicine = x.HasMedicine58 })59 45 .OrderBy(x => x.Medicine.Name) 60 46 .Cast<ICollection<MedicineList>>(); … … 63 49 public void Remove(MedicineList medicineList) 64 50 { 65 var list = _context.MedicineLists.Where(x => x.Medicine.Equals(medicineList.Medicine)).FirstOrDefault(); 66 if (list != null) 67 { 68 _context.MedicineLists.Remove(list); 69 _context.SaveChangesAsync(); 70 } 51 var list = (MedicineList)_context.MedicineLists.Where(x => x.Medicine.Equals(medicineList.Medicine)); 52 _context.MedicineLists.Remove(list); 71 53 } 72 54 }
Note:
See TracChangeset
for help on using the changeset viewer.