Esempio n. 1
0
 public string GetName(int locationId)
 {
     using (var context = DbContextCreator.Create())
     {
         return((from x in context.Locations where x.LocationId == locationId select x.Name).FirstOrDefault());
     }
 }
Esempio n. 2
0
 public List <Location> GetByGu()
 {
     using (var context = DbContextCreator.Create())
     {
         return(context.Locations.Where(x => x.UpperId == null).ToList());
     }
 }
Esempio n. 3
0
 public string GetName(int fieldId)
 {
     using (var context = DbContextCreator.Create())
     {
         return((from x in context.Fields where x.FieldId == fieldId select x.Name).FirstOrDefault());
     }
 }
Esempio n. 4
0
 public T GetByPK(K key)
 {
     using (DbContext context = DbContextCreator.Create())
     {
         return(context.Set <T>().Find(key));
     }
 }
Esempio n. 5
0
 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());
     }
 }
Esempio n. 6
0
 public int GetCount()
 {
     using (var context = DbContextCreator.Create())
     {
         return(context.Set <T>().Count());
     }
 }
Esempio n. 7
0
 public List <T> GetAll()
 {
     using (var context = DbContextCreator.Create())
     {
         return(context.Set <T>().ToList());
     }
 }
Esempio n. 8
0
 internal List <Competitor> GetByField(int fieldId)
 {
     using (var context = DbContextCreator.Create())
     {
         return(context.Competitors.Where(x => x.FieldId == fieldId).ToList());
     }
 }
Esempio n. 9
0
 internal List <LandPriceIndex> GetByLocation(int locationId)
 {
     using (var context = DbContextCreator.Create())
     {
         return((from x in context.LandPriceIndexes
                 where x.LocationId == locationId
                 select x).ToList());
     }
 }
Esempio n. 10
0
        public void Delete(T entity)
        {
            using (var context = DbContextCreator.Create())
            {
                context.Entry(entity).State = System.Data.Entity.EntityState.Deleted;

                context.SaveChanges();
            }
        }
Esempio n. 11
0
        public void Insert(T entity)
        {
            using (var context = DbContextCreator.Create())
            {
                context.Set <T>().Add(entity);

                context.SaveChanges();
            }
        }
Esempio n. 12
0
        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());
            }
        }
Esempio n. 13
0
        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());
            }
        }
Esempio n. 14
0
        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());
                }
            }
        }