public int Count() { using (EShopDB db = new EShopDB()) { int count = db.BookType.Count(); return(count); } }
public bool InsertSaleDetail(SaleDetail detail) { using (EShopDB db = new EShopDB()) { db.SaleDetail.Add(detail); bool isSuccess = db.SaveChanges() > 0; return(isSuccess); } }
public bool InsertCartInfo(ShoppingCart cInfo) { using (EShopDB db = new EShopDB()) { db.ShoppingCart.Add(cInfo); bool isSuccess = db.SaveChanges() > 0; return(isSuccess); } }
public bool InsertOtherType(OtherType otherType) { using (EShopDB db = new EShopDB()) { db.OtherType.Add(otherType); bool isSuccess = db.SaveChanges() > 0; return(isSuccess); } }
public bool InsertBookInfo(BookInfo bookInfo) { using (EShopDB db = new EShopDB()) { db.BookInfo.Add(bookInfo); bool isSuccess = db.SaveChanges() > 0; return(isSuccess); } }
public bool InsertRecommend(Recommend recommend) { using (EShopDB db = new EShopDB()) { db.Recommend.Add(recommend); bool isSuccess = db.SaveChanges() > 0; return(isSuccess); } }
public bool InsertBookSale(BookSale bookSale) { using (EShopDB db = new EShopDB()) { db.BookSale.Add(bookSale); bool isSuccess = db.SaveChanges() > 0; return(isSuccess); } }
public bool InsertUserInfo(UserInfo userInfo) { using (EShopDB db = new EShopDB()) { db.UserInfo.Add(userInfo); bool isSuccess = db.SaveChanges() > 0; return(isSuccess); } }
public BookType FindByName(string name) { using (EShopDB db = new EShopDB()) { var obj = (from bt in db.BookType where bt.TypeName.Contains(name) select bt).FirstOrDefault(); return(obj); } }
public int GetTypeCount(string type) { using (EShopDB db = new EShopDB()) { int count = (from b in db.BookInfo where b.Type == type select b).Count(); return(count); } }
public List <BookType> FindBookType() { using (EShopDB db = new EShopDB()) { var obj = from bt in db.BookType orderby bt.TypeCode select bt; return(obj.ToList()); } }
public int GetAdminCount(string search, int role) { using (EShopDB db = new EShopDB()) { int count = (from u in db.UserInfo where (u.Name.Contains(search) || u.LoginId.Contains(search)) && u.Role >= role select u).Count(); return(count); } }
public UserInfo FindByLoginId(string loginId) { using (EShopDB db = new EShopDB()) { var obj = (from u in db.UserInfo where u.LoginId == loginId select u).FirstOrDefault(); return(obj); } }
public BookSaleView FindById(string id) { using (EShopDB db = new EShopDB()) { var obj = (from b in db.BookSaleView where b.Id == id select b).FirstOrDefault(); return(obj); } }
public int GetCount(string search) { using (EShopDB db = new EShopDB()) { int count = (from b in db.BookSaleView where b.UserName.Contains(search) || b.SaleNum.Contains(search) select b).Count(); return(count); } }
public int GetCount(string search) { using (EShopDB db = new EShopDB()) { int count = (from b in db.BookInfo where b.Name.Contains(search) || b.Author.Contains(search) select b).Count(); return(count); } }
public int GetCount(string search) { using (EShopDB db = new EShopDB()) { int count = (from r in db.RecommendView where r.BookName.Contains(search) || r.ShowTitle.Contains(search) select r).Count(); return(count); } }
public int GetBuyCount(string uid) { using (EShopDB db = new EShopDB()) { int count = (from b in db.BookSaleView where b.UserId == uid select b).Count(); return(count); } }
public RecommendView FindDetailById(string id) { using (EShopDB db = new EShopDB()) { var obj = (from r in db.RecommendView where r.Id == id select r).FirstOrDefault(); return(obj); } }
public bool UpdateUserRole(UserInfo userInfo) { using (EShopDB db = new EShopDB()) { var oldUserInfo = db.UserInfo.Find(userInfo.Id); oldUserInfo.Role = userInfo.Role; bool isSuccess = db.SaveChanges() > 0; return(isSuccess); } }
public BookType FindById(string id) { using (EShopDB db = new EShopDB()) { var obj = (from bt in db.BookType where bt.Id == id select bt).FirstOrDefault(); return(obj); } }
public OtherType FindById(string id) { using (EShopDB db = new EShopDB()) { var obj = (from ot in db.OtherType where ot.Id == id select ot).FirstOrDefault(); return(obj); } }
public int GetCount(string uid) { using (EShopDB db = new EShopDB()) { int count = (from c in db.CartView where c.UserId == uid select c).Count(); return(count); } }
public List <BookInfo> FindTopSale(int size) { using (EShopDB db = new EShopDB()) { var obj = from b in db.BookInfo orderby b.Sale descending select b; List <BookInfo> list = obj.Take(size).ToList(); return(list); } }
public List <SaleDetailView> FindSaleDetail(string BsId) { using (EShopDB db = new EShopDB()) { var obj = from b in db.SaleDetailView where b.BsId == BsId select b; List <SaleDetailView> list = obj.ToList(); return(list); } }
public List <BookInfo> FindByType(string type, int size) { using (EShopDB db = new EShopDB()) { var obj = from b in db.BookInfo where b.Type == type orderby b.PublishDate descending select b; List <BookInfo> list = obj.Take(size).ToList(); return(list); } }
public List <BookInfo> FindByAuthor(string author) { using (EShopDB db = new EShopDB()) { var obj = from b in db.BookInfo where b.Author == author orderby b.CreateDate descending select b; List <BookInfo> list = obj.ToList(); return(list); } }
public List <BookSaleView> FindByUserId(string uid) { using (EShopDB db = new EShopDB()) { var obj = from b in db.BookSaleView where b.UserId == uid orderby b.CreateTime descending select b; List <BookSaleView> list = obj.ToList(); return(list); } }
public bool UpdateBookInfoStock(string id, int num) { using (EShopDB db = new EShopDB()) { var bookInfo = db.BookInfo.Find(id); if (bookInfo.Stock == null) { bookInfo.Stock = 0; } bookInfo.Stock = bookInfo.Stock + num; return(db.SaveChanges() > 0); } }
public bool DeleteOtherType(string id) { using (EShopDB db = new EShopDB()) { OtherType otherType = new OtherType() { Id = id }; db.OtherType.Attach(otherType); db.OtherType.Remove(otherType); bool isSuccess = db.SaveChanges() > 0; return(isSuccess); } }