public async Task <IActionResult> Edit(string id, [Bind("ProdId,ProdType")] ProdMst prodMst) { if (id != prodMst.ProdId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(prodMst); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProdMstExists(prodMst.ProdId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(prodMst)); }
public ActionResult DeleteConfirmed(string id) { ProdMst prodMst = db.ProdMsts.Find(id); db.ProdMsts.Remove(prodMst); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(ProdMst prod) { if (ModelState.IsValid) { db.Edit(prod); return(RedirectToAction("Index")); } return(View()); }
public ActionResult Edit([Bind(Include = "ProdId,ProdType,ProdThumbnail")] ProdMst prodMst) { if (ModelState.IsValid) { db.Entry(prodMst).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(prodMst)); }
public async Task <IActionResult> Create([Bind("ProdId,ProdType")] ProdMst prodMst) { if (ModelState.IsValid) { _context.Add(prodMst); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(prodMst)); }
public ActionResult Create([Bind(Include = "ProdId,ProdType,ProdThumbnail")] ProdMst prodMst) { prodMst.ProdId = "pro" + Guid.NewGuid().ToString().GetHashCode().ToString("x"); if (ModelState.IsValid) { db.ProdMsts.Add(prodMst); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(prodMst)); }
// GET: Admin/ProdMsts/Delete/5 public ActionResult Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProdMst prodMst = db.ProdMsts.Find(id); if (prodMst == null) { return(HttpNotFound()); } return(View(prodMst)); }