public ActionResult DeleteConfirmed(string id) { PhieuNhapSP phieuNhapSP = db.PhieuNhapSP.Find(id); db.PhieuNhapSP.Remove(phieuNhapSP); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: PhieuNhapSPs/Details/5 public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PhieuNhapSP phieuNhapSP = db.PhieuNhapSP.Find(id); if (phieuNhapSP == null) { return(HttpNotFound()); } return(View(phieuNhapSP)); }
// GET: PhieuNhapSPs/Edit/5 public ActionResult Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PhieuNhapSP phieuNhapSP = db.PhieuNhapSP.Find(id); if (phieuNhapSP == null) { return(HttpNotFound()); } ViewBag.MaNCC = new SelectList(db.NhaCungCap, "MaNCC", "TenNCC", phieuNhapSP.MaNCC); ViewBag.MaNV = new SelectList(db.NhanVien, "MaNV", "MaLoaiNV", phieuNhapSP.MaNV); return(View(phieuNhapSP)); }
public ActionResult Edit([Bind(Include = "MaPN,MaNCC,MaNV,NgayNhap,GhiChuPN,SLNhap")] PhieuNhapSP phieuNhapSP) { if (ModelState.IsValid) { if (Common.MaNV != "") { } else { Common.Alert = "Đăng nhập trước khi chỉnh sữa !"; return(RedirectToAction("Index", "Logins")); } db.Entry(phieuNhapSP).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MaNCC = new SelectList(db.NhaCungCap, "MaNCC", "TenNCC", phieuNhapSP.MaNCC); ViewBag.MaNV = new SelectList(db.NhanVien, "MaNV", "MaLoaiNV", phieuNhapSP.MaNV); return(View(phieuNhapSP)); }