public ActionResult Edit([Bind(Include = "Id,StatusType,CreatedOn,CreatedBy,UpdatedOn,UpdatedBy")] LookupPgxStatu lookupPgxStatu) { if (ModelState.IsValid) { lookupPgxStatu.UpdatedBy = CurrentUser.Id; lookupPgxStatu.UpdatedOn = DateTime.UtcNow; db.Entry(lookupPgxStatu).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CreatedBy = new SelectList(db.Users, "Id", "UserName", lookupPgxStatu.CreatedBy); ViewBag.UpdatedBy = new SelectList(db.Users, "Id", "UserName", lookupPgxStatu.UpdatedBy); return(View(lookupPgxStatu)); }
// GET: Admin/PgxStatus/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LookupPgxStatu lookupPgxStatu = db.LookupPgxStatus.Find(id); if (lookupPgxStatu == null) { return(HttpNotFound()); } return(View(lookupPgxStatu)); }
// GET: Admin/PgxStatus/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LookupPgxStatu lookupPgxStatu = db.LookupPgxStatus.Find(id); if (lookupPgxStatu == null) { return(HttpNotFound()); } ViewBag.CreatedBy = new SelectList(db.Users, "Id", "UserName", lookupPgxStatu.CreatedBy); ViewBag.UpdatedBy = new SelectList(db.Users, "Id", "UserName", lookupPgxStatu.UpdatedBy); return(View(lookupPgxStatu)); }
public ActionResult DeleteConfirmed(int id) { LookupPgxStatu lookupPgxStatu = db.LookupPgxStatus.Find(id); try { db.LookupPgxStatus.Remove(lookupPgxStatu); db.SaveChanges(); } catch (DbUpdateException ex) { ModelState.AddModelError("Error", "There are some releted item in database, please delete those first"); return(View("Delete", lookupPgxStatu)); } return(RedirectToAction("Index")); }