public string GetName(int locationId) { using (var context = DbContextCreator.Create()) { return((from x in context.Locations where x.LocationId == locationId select x.Name).FirstOrDefault()); } }
public List <Location> GetByGu() { using (var context = DbContextCreator.Create()) { return(context.Locations.Where(x => x.UpperId == null).ToList()); } }
public string GetName(int fieldId) { using (var context = DbContextCreator.Create()) { return((from x in context.Fields where x.FieldId == fieldId select x.Name).FirstOrDefault()); } }
public T GetByPK(K key) { using (DbContext context = DbContextCreator.Create()) { return(context.Set <T>().Find(key)); } }
public List <FootTraffic> GetByStationAndMonth(int stationId, DateTime month) { using (SSTAAEntities context = DbContextCreator.Create()) { return(context.FootTraffics.Where(x => x.StationId == stationId && x.Date.Year == month.Year && x.Date.Month == month.Month).ToList()); } }
public int GetCount() { using (var context = DbContextCreator.Create()) { return(context.Set <T>().Count()); } }
public List <T> GetAll() { using (var context = DbContextCreator.Create()) { return(context.Set <T>().ToList()); } }
internal List <Competitor> GetByField(int fieldId) { using (var context = DbContextCreator.Create()) { return(context.Competitors.Where(x => x.FieldId == fieldId).ToList()); } }
internal List <LandPriceIndex> GetByLocation(int locationId) { using (var context = DbContextCreator.Create()) { return((from x in context.LandPriceIndexes where x.LocationId == locationId select x).ToList()); } }
public void Delete(T entity) { using (var context = DbContextCreator.Create()) { context.Entry(entity).State = System.Data.Entity.EntityState.Deleted; context.SaveChanges(); } }
public void Insert(T entity) { using (var context = DbContextCreator.Create()) { context.Set <T>().Add(entity); context.SaveChanges(); } }
public List <string> GetFieldName() { using (var context = DbContextCreator.Create()) { var query = from x in context.Fields orderby x.FieldId select x.Name; return(query.ToList()); } }
public List <string> GetGuName() { using (var context = DbContextCreator.Create()) { var query = from x in context.Locations orderby x.LocationId where x.UpperId == null select x.Name; return(query.ToList()); } }
public List <FootTraffic> GetByStation(int stationId) { using (var context = DbContextCreator.Create()) { var query = context.FootTraffics.Where(x => x.StationId == stationId); if (query.FirstOrDefault() == null) { return(null); } else { return(query.ToList()); } } }