public int GetCount()
 {
     using (DVDRentEntities context = new DVDRentEntities())
     {
         return(context.Set <T>().Count());
     }
 }
        public List <Rent> SearchDate(DateTime value)
        {
            using (DVDRentEntities context = new DVDRentEntities())
            {
                var query = from x in context.Rents
                            where x.RentDate.Day == value.Day && x.RentDate.Month == value.Month
                            select new
                {
                    Rent    = x,
                    CusName = x.Customer.Name,
                    Title   = x.DVD.Title,
                    Genre   = x.DVD.Genre
                };


                foreach (var item in query)
                {
                    item.Rent.CusName = item.CusName;
                    item.Rent.Title   = item.Title;
                    item.Rent.Genre   = item.Genre;
                }

                var list = query.ToList();

                return(list.ConvertAll(x => x.Rent));
            }
        }
 public List <T> GetAll()
 {
     using (DVDRentEntities context = new DVDRentEntities())
     {
         return(context.Set <T>().ToList());
     }
 }
Example #4
0
 public int Count()
 {
     using (DVDRentEntities context = new DVDRentEntities())
     {
         return(context.Customers.Count() + 1);
     }
 }
Example #5
0
 public List <Customer> Get()
 {
     using (DVDRentEntities context = new DVDRentEntities())
     {
         return(context.Set <Customer>().ToList());
     }
 }
 public void Insert(T entity)
 {
     using (DVDRentEntities context = new DVDRentEntities())
     {
         context.Set <T>().Add(entity);
         context.SaveChanges();
     }
 }
        public void Delete(T entity)
        {
            using (DVDRentEntities context = new DVDRentEntities())
            {
                context.Entry(entity).State = EntityState.Deleted;

                context.SaveChanges();
            }
        }
Example #8
0
 public List <DVD> Get(int dvdNum)
 {
     using (DVDRentEntities context = new DVDRentEntities())
     {
         var query = from x in context.DVDs
                     where x.DvdID == dvdNum
                     select x;
         return(query.ToList());
     }
 }
Example #9
0
        public List <DVD> SearchStateFalse()
        {
            using (DVDRentEntities context = new DVDRentEntities())
            {
                var query = from x in context.DVDs
                            where x.RentStatus == false
                            select x;

                return(query.ToList());
            }
        }
Example #10
0
        public List <Customer> SearchIdList(string id)
        {
            using (DVDRentEntities context = new DVDRentEntities())
            {
                var query = from x in context.Customers
                            where x.LoginID.Equals(id)
                            select x;

                return(query.ToList());
            }
        }
Example #11
0
        public Customer SearchId(string id)
        {
            using (DVDRentEntities context = new DVDRentEntities())
            {
                var query = from x in context.Customers
                            where x.LoginID == id
                            select x;
                Customer customer = new Customer();
                customer = query.FirstOrDefault();

                return(customer);
            }
        }
Example #12
0
        public DVD SearchDVDNum(int dvdNum)
        {
            using (DVDRentEntities context = new DVDRentEntities())
            {
                var query = from x in context.DVDs
                            where x.DvdID == dvdNum
                            select x;

                DVD dvd = new DVD();
                dvd = query.FirstOrDefault();

                return(dvd);
            }
        }
Example #13
0
        public bool CheckDVDNum(int dvdNum)
        {
            using (DVDRentEntities context = new DVDRentEntities())
            {
                var query = from x in context.DVDs
                            where x.DvdID == dvdNum
                            select x;

                DVD dvd = new DVD();
                dvd = query.FirstOrDefault();

                if (dvd == null)
                {
                    return(false);
                }
                return(true);
            }
        }
Example #14
0
        /// <summary>
        /// 참 은 가지고있다 불은 중복 되지 않았다.
        /// </summary>
        public bool CheckId(string id)
        {
            using (DVDRentEntities context = new DVDRentEntities())
            {
                var query = from x in context.Customers
                            where x.LoginID == id
                            select x;

                Customer customer = new Customer();
                customer = query.FirstOrDefault();

                if (customer == null)
                {
                    return(false);
                }

                return(true);
            }
        }