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