Changeset d2e69be for FarmatikoData/FarmatikoRepo
- Timestamp:
- 07/27/20 17:10:07 (4 years ago)
- Branches:
- master
- Children:
- ef1219a
- Parents:
- 4b342bb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
FarmatikoData/FarmatikoRepo/HealthFacilityRepository.cs
r4b342bb rd2e69be 26 26 public IEnumerable<HealthFacilities> GetAll() 27 27 { 28 return _context.HealthFacilities ;28 return _context.HealthFacilities.OrderBy(x => x.Name).ToList(); 29 29 } 30 30 31 public HealthFacilities GetByFullName(string FullName)31 public IEnumerable<HealthFacilities> GetAllByName(string Name) 32 32 { 33 return (HealthFacilities)_context.HealthFacilities34 .Where(Facility => Facility.Name == FullName) 35 .FirstOrDefault(Facility => Facility.Name == FullName);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 36 } 37 37 38 public HealthFacilities GetByType(string FacilityType)38 IEnumerable<HealthFacilities> IHealthFacilityRepository.GetByType(string Type) 39 39 { 40 return (HealthFacilities)_context.HealthFacilities 41 .Where(FacilityType => FacilityType.Type.Equals(FacilityType)) 42 .FirstOrDefault(FacilityType => FacilityType.Name.Equals(FacilityType)); 40 return (IEnumerable<HealthFacilities>)_context.HealthFacilities 41 .Where(type => type.Type.Equals(Type)); 43 42 } 44 45 public void Remove(string healthFacility)46 {47 HealthFacilities Facility = (HealthFacilities)_context.HealthFacilities.Where(healthFacility => healthFacility.Name.Equals(healthFacility));48 _context.Remove(Facility);49 _context.SaveChangesAsync();50 }51 52 43 } 53 44 }
Note:
See TracChangeset
for help on using the changeset viewer.