public ActionResult UpdateInfo(int?id, int?param, string returnmessage) { //========== Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1)); Response.Cache.SetNoStore(); if (Session != null) { if (Session["AdminUser"] == null) { return(RedirectToAction("AdminLogin", "Home")); } else { if (id == null) { return(HttpNotFound()); } person = user.GetUser(id, param); if (person == null) { return(HttpNotFound()); } ViewBag.message = returnmessage; return(View(person)); } } else { return(RedirectToAction("AdminLogin", "Home")); } }
public ActionResult Process(int?id, int?param) { Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1)); Response.Cache.SetNoStore(); if (Session != null) { if (Session["AdminUser"] == null) { return(RedirectToAction("AdminLogin", "Home")); } else { WebApplication.Models.ThreatReportViewModel viewModel = new WebApplication.Models.ThreatReportViewModel(); if (id == null) { return(HttpNotFound()); } viewModel = user.GetThreatRequest(id, param); person = user.GetUser(param, 0); viewModel.Users = person; viewModel = Initialize(viewModel); viewModel = InitializeWhoToNotify(viewModel); if (viewModel.Threat == null) { return(HttpNotFound()); } return(View(viewModel)); } } else { return(RedirectToAction("AdminLogin", "Home")); } }
public ActionResult UpdateInfo(WebApplication.Models.cPerson userobj) { if ((userobj == null)) { return(HttpNotFound()); } else { ModelState.Remove("password"); ModelState.Remove("Confirmpassword"); ModelState.Remove("workat"); var errors = ModelState .Where(x => x.Value.Errors.Count > 0) .Select(x => new { x.Key, x.Value.Errors }) .ToArray(); if (ModelState.IsValid) { if (user.UpdatUserInfo(userobj)) { string Subject = "Profile Updated "; string Body = "Your profile settings have successfully been updated. Go to Profile Settings to view the changes."; Models.Admin.SendEmail(userobj.email, Subject, Body); return(RedirectToAction("InfoUpdateRequests")); } else { var message = "Error while updating the profile, try later."; return(RedirectToAction("InfoUpdateRequests", new { returnmessage = message })); } } else { return(View(userobj)); } } }