/// <summary> /// Chọn hàng (bỏ hàng vào giỏ) /// </summary> /// <param name="Id">Mã mặt hàng được chọn</param> public void Add(int Id, int quantity = 1) { try { var p = Items.Single(i => i.MaCaThe == Id); } catch // Chưa có trong giỏ -> Lấy từ DB { using (var db = new GShopEntities()) { var p = db.CaThes.Find(Id); Items.Add(p); } } }
public AllRepo(GShopEntities dbContext) { _dbContext = dbContext; _dbset = _dbContext.Set <TEntity>(); }
public AllRepo() { _dbContext = new GShopEntities(); _dbset = _dbContext.Set <TEntity>(); }
public UserDAO() { db = new GShopEntities(); }
public AdminDAO() { db = new GShopEntities(); }