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