예제 #1
0
파일: LocationDao.cs 프로젝트: D-Gun/SSTAA
 public string GetName(int locationId)
 {
     using (var context = DbContextCreator.Create())
     {
         return((from x in context.Locations where x.LocationId == locationId select x.Name).FirstOrDefault());
     }
 }
예제 #2
0
파일: LocationDao.cs 프로젝트: D-Gun/SSTAA
 public List <Location> GetByGu()
 {
     using (var context = DbContextCreator.Create())
     {
         return(context.Locations.Where(x => x.UpperId == null).ToList());
     }
 }
예제 #3
0
파일: FieldDao.cs 프로젝트: D-Gun/SSTAA
 public string GetName(int fieldId)
 {
     using (var context = DbContextCreator.Create())
     {
         return((from x in context.Fields where x.FieldId == fieldId select x.Name).FirstOrDefault());
     }
 }
예제 #4
0
 public T GetByPK(K key)
 {
     using (DbContext context = DbContextCreator.Create())
     {
         return(context.Set <T>().Find(key));
     }
 }
예제 #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());
     }
 }
예제 #6
0
 public int GetCount()
 {
     using (var context = DbContextCreator.Create())
     {
         return(context.Set <T>().Count());
     }
 }
예제 #7
0
 public List <T> GetAll()
 {
     using (var context = DbContextCreator.Create())
     {
         return(context.Set <T>().ToList());
     }
 }
예제 #8
0
 internal List <Competitor> GetByField(int fieldId)
 {
     using (var context = DbContextCreator.Create())
     {
         return(context.Competitors.Where(x => x.FieldId == fieldId).ToList());
     }
 }
예제 #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());
     }
 }
예제 #10
0
        public void Delete(T entity)
        {
            using (var context = DbContextCreator.Create())
            {
                context.Entry(entity).State = System.Data.Entity.EntityState.Deleted;

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

                context.SaveChanges();
            }
        }
예제 #12
0
파일: FieldDao.cs 프로젝트: D-Gun/SSTAA
        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());
            }
        }
예제 #13
0
파일: LocationDao.cs 프로젝트: D-Gun/SSTAA
        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());
            }
        }
예제 #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());
                }
            }
        }