public ActionResult TTNhanVien(FormCollection collection) { NhanVienBH bH = new NhanVienBH(); string sTenNV = collection["txtTen"]; string sDiaChi = collection["txtDiaChi"]; decimal sSDT = decimal.Parse(collection["txtSDT"]); string sEmail = collection["txtEmail"]; bH.Ten_NV = sTenNV; bH.Dia_Chi_NV = sDiaChi; bH.SDT_NV = sSDT; bH.Email_NV = sEmail; db.NhanVienBH.Add(bH); db.SaveChanges(); return(View()); }
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()); } }