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

Add more services

Location:
FarmatikoData/FarmatikoRepo
Files:
1 added
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • FarmatikoData/FarmatikoRepo/HealthFacilityRepository.cs

    ref1219a re42f61a  
    2929        }
    3030
    31         public IEnumerable<HealthFacilities> GetAllByName(string Name)
    32         {
    33             Name = Name.ToLower();
    34 
    35             return _context.HealthFacilities.Where(x => x.Name.ToLower().Contains(Name)).OrderBy(x => x.Name.ToLower().IndexOf(Name)).ToList();
    36         }
    37 
    38         IEnumerable<HealthFacilities> IHealthFacilityRepository.GetByType(string Type)
    39         {
    40             return (IEnumerable<HealthFacilities>)_context.HealthFacilities
    41                .Where(type => type.Type.Equals(Type));
    42         }
    4331    }
    4432}
  • 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    }
  • FarmatikoData/FarmatikoRepo/MedicineRepository.cs

    ref1219a re42f61a  
    2727        }
    2828
    29         public Medicine GetByName(string Name)
     29        public IEnumerable<Medicine> GetByManufacturer(string Manufacturer)
    3030        {
    31             return (Medicine)_context.Medicines.Where(medicine => medicine.Name == Name);
     31            return _context.Medicines.Where(x => x.Name.Contains(Manufacturer)).OrderBy(x => x.Manufacturer);
     32        }
     33
     34        public IEnumerable<Medicine> GetByName(string Name)
     35        {
     36            return (IEnumerable<Medicine>)_context.Medicines.Where(medicine => medicine.Name == Name);
    3237        }
    3338
     
    3540        {
    3641            Medicine med = (Medicine)_context.Medicines.Where(medicine => medicine.Name.Equals(medicine));
    37             _context.Medicines.Remove(med);
     42            _context.Remove(med);
    3843        }
    3944    }
Note: See TracChangeset for help on using the changeset viewer.