Ignore:
Timestamp:
07/29/20 13:21:48 (4 years ago)
Author:
DimitarSlezenkovski <dslezenkovski@…>
Branches:
master
Children:
de18858
Parents:
ef1219a
Message:

Add more services

File:
1 edited

Legend:

Unmodified
Added
Removed
  • FarmatikoData/FarmatikoRepo/MedicineListRepository.cs

    ref1219a re42f61a  
    2020            _context.SaveChangesAsync();
    2121        }
     22        // Maybe later
     23        /*public MedicineList CheckMedicine(string Name)
     24        {
     25            return (MedicineList)_context.MedicineLists
     26                .Where(medicineList => medicineList.Medicine.Name.Contains(Name))
     27                .OrderBy(x => x.Medicine.Name);
     28        }*/
    2229
    23         public MedicineList CheckMedicine(string Name)
     30        public ICollection<MedicineList> GetAll()
    2431        {
    25             return (MedicineList)_context.MedicineLists.Where(medicineList => medicineList.Medicine.Name.Equals(Name));
     32            return (ICollection<MedicineList>)_context.MedicineLists.OrderBy(x => x.Medicine.Name);
    2633        }
    2734
    28         public MedicineList GetAll()
     35        public ICollection<MedicineList> GetByManufacturer(string Manufacturer)
    2936        {
    30             return (MedicineList)_context.MedicineLists.Include(list => list.Medicine).Include(list => list.HasMedicine);
     37            return (ICollection<MedicineList>)_context.MedicineLists
     38                .Where(x => x.Medicine.Manufacturer.Contains(Manufacturer))
     39                .OrderBy(x => x.Medicine.Name);
     40        }
     41        public ICollection<MedicineList> GetByName(string Name)
     42        {
     43            return (ICollection<MedicineList>)_context.MedicineLists
     44                .Where(x => x.Medicine.Name.Contains(Name))
     45                .OrderBy(x => x.Medicine.Name);
    3146        }
    3247
    3348        public void Remove(MedicineList medicineList)
    3449        {
    35             //throw new NotImplementedException();
    36             //Implement later
     50            var list = (MedicineList)_context.MedicineLists.Where(x => x.Equals(medicineList));
     51            _context.Remove(list);
     52        }
     53
     54        public void SetHasMedicine(MedicineList medicineList, bool HasMedicine)
     55        {
     56            var medicine = _context.MedicineLists.Where(x => x.Medicine.Equals(medicineList.Medicine));
    3757        }
    3858    }
Note: See TracChangeset for help on using the changeset viewer.