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()); } }
public int Count() { using (DVDRentEntities context = new DVDRentEntities()) { return(context.Customers.Count() + 1); } }
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(); } }
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()); } }
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()); } }
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()); } }
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); } }
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); } }
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); } }
/// <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); } }