public ActionResult DeleteConfirmed(int id) { DanhHieu danhhieu = db.DanhHieu.Find(id); db.DanhHieu.Remove(danhhieu); db.SaveChanges(); return(RedirectToAction("Index")); }
// // GET: /DanhHieu/Details/5 public ActionResult Details(int id = 0) { DanhHieu danhhieu = db.DanhHieu.Find(id); if (danhhieu == null) { return(HttpNotFound()); } return(View(danhhieu)); }
public ActionResult Edit(DanhHieu danhhieu) { if (ModelState.IsValid) { db.Entry(danhhieu).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.TenDanhHieu_id = new SelectList(db.dmDanhHieu, "id", "TenDanhHieu", danhhieu.TenDanhHieu_id); ViewBag.NV_id = new SelectList(db.NhanVien, "id", "MaNV", danhhieu.NV_id); return(View(danhhieu)); }
// // GET: /DanhHieu/Edit/5 public ActionResult Edit(int id = 0) { DanhHieu danhhieu = db.DanhHieu.Find(id); if (danhhieu == null) { return(HttpNotFound()); } ViewBag.TenDanhHieu_id = new SelectList(db.dmDanhHieu, "id", "TenDanhHieu", danhhieu.TenDanhHieu_id); ViewBag.NV_id = new SelectList(db.NhanVien, "id", "MaNV", danhhieu.NV_id); return(View(danhhieu)); }
public ActionResult Create(DanhHieu danhhieu) { if (ModelState.IsValid) { db.DanhHieu.Add(danhhieu); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.TenDanhHieu_id = new SelectList(db.dmDanhHieu, "id", "TenDanhHieu", danhhieu.TenDanhHieu_id); ViewBag.NV_id = new SelectList(db.NhanVien, "id", "MaNV", danhhieu.NV_id); return(View(danhhieu)); }