public async Task <ActionResult> DeleteConfirmed(string id) { MyPham myPham = await db.MyPhams.FindAsync(id); db.MyPhams.Remove(myPham); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "MaMP,TenMP,ThuongHieu,TenCongDung")] MyPham myPham) { if (ModelState.IsValid) { db.Entry(myPham).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.TenCongDung = new SelectList(db.ConngDungs, "MaCongDung", "TenCongDung", myPham.TenCongDung); return(View(myPham)); }
// GET: MyPhams/Details/5 public async Task <ActionResult> Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MyPham myPham = await db.MyPhams.FindAsync(id); if (myPham == null) { return(HttpNotFound()); } return(View(myPham)); }
// GET: MyPhams/Edit/5 public async Task <ActionResult> Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MyPham myPham = await db.MyPhams.FindAsync(id); if (myPham == null) { return(HttpNotFound()); } ViewBag.TenCongDung = new SelectList(db.ConngDungs, "MaCongDung", "TenCongDung", myPham.TenCongDung); return(View(myPham)); }