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