public ActionResult PrimeUserUpdate(superuser obj) { try { if (ModelState.IsValid) { if (obj.ID > 0) { _superuser.Update(obj); _superuser.Save(); TempData["Message"] = string.Format("Super User Updated Successfully!!!"); } return(RedirectToAction("SuperUserList")); } else { return(View(obj)); } } catch (Exception ex) { TempData["Alert"] = string.Format("A server error occurred. Please contact the administrator."); return(RedirectToAction("SuperUserList")); } }
public ActionResult SuperUserSave(superuser obj) { try { if (ModelState.IsValid) { if (obj.ID == 0) { obj.CreatedDate = DateTime.Now; obj.UltimateUser = "******"; _superuser.Insert(obj); _superuser.Save(); TempData["Message"] = string.Format("Super User Saved Successfully!!!"); } return(RedirectToAction("SuperUserList")); } else { return(View(obj)); } } catch (Exception ex) { TempData["Alert"] = string.Format("A server error occurred. Please contact the administrator."); return(RedirectToAction("SuperUserList")); } }
public ActionResult PrimeUserUpdate(int?id) { superuser model = new superuser(); model = db.superusers.Where(m => m.ID == id).FirstOrDefault(); if (model == null) { TempData["Alert"] = string.Format("A server error occurred. Please contact the administrator."); } return(View(model)); }