// GET: TTNV/Delete/5 public ActionResult Delete(int id) { using (HopLucShopEntities db = new HopLucShopEntities()) { return(View(db.NhanVienBH.SingleOrDefault(x => x.ID_NV == id))); } }
// GET: TTNV public ActionResult Index() { using (HopLucShopEntities db = new HopLucShopEntities()) { return(View(db.NhanVienBH.ToList())); } }
public ActionResult Edit(int id, NhanVienBH bH) { try { // TODO: Add update logic here using (HopLucShopEntities db = new HopLucShopEntities()) { db.Entry(bH).State = EntityState.Modified; db.SaveChanges(); } return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Delete(int id, FormCollection collection) { try { // TODO: Add delete logic here using (HopLucShopEntities db = new HopLucShopEntities()) { NhanVienBH vienBH = db.NhanVienBH.Where(x => x.ID_NV == id).FirstOrDefault(); db.NhanVienBH.Remove(vienBH); db.SaveChanges(); } return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(NhanVienBH bH) { try { using (HopLucShopEntities db = new HopLucShopEntities()) { db.NhanVienBH.Add(bH); db.SaveChanges(); } // TODO: Add insert logic here return(RedirectToAction("Index")); } catch { return(View()); } }