public ActionResult PostAdminProfile(User _user) { try { if (ValidateLogin() == false) { return(RedirectToAction("Login", "Auth", new { msg = "Session Expired from ADMIN DashBoard, plz login again", color = "Red" })); } bool chkEmail = gp.ValidateEmail(_user.Email, _user.Id); if (chkEmail == false) { return(RedirectToAction("AdminProfile", "Admin", new { id = _user.Id, msg = "Emaial exists", color = "Red" })); } User updateAdmin = new UserBL().GetUserById(_user.Id, db); updateAdmin.FirstName = _user.FirstName.Trim(); updateAdmin.LastName = _user.LastName.Trim(); updateAdmin.Contact = _user.Contact.Trim(); updateAdmin.Password = _user.Password.Trim(); updateAdmin.Email = _user.Email.Trim(); bool checkUser = new UserBL().UpdateUser(updateAdmin, db); if (checkUser == true) { return(RedirectToAction("AdminDashboard", "Admin", new { msg = "Profile updated successfully", color = "green" })); } else { return(RedirectToAction("AdminDashboard", "Admin", new { msg = "Profile updated Unsuccessfully bcz yoy enter empty name or maybe same email which exist in DB", color = "Red" })); } } catch { return(RedirectToAction("Error", "Auth", new { msg = "search for the page was not found", color = "Red" })); } }
public ActionResult PostUserProfile(User _user) { try { if (ValidateLogin() == false) { return(RedirectToAction("Login", "Auth", new { msg = "Session Expired from User DashBoard, plz login again", color = "Red" })); } bool chkEmail = gp.ValidateEmail(_user.Email, _user.Id); if (chkEmail == false) { return(RedirectToAction("UserProfile", "User", new { id = _user.Id, msg = "Emaial exists", color = "Red" })); } User updateUser = new UserBL().GetUserById(_user.Id, db); updateUser.FirstName = _user.FirstName.Trim(); updateUser.LastName = _user.LastName.Trim(); updateUser.Contact = _user.Contact.Trim(); updateUser.Password = _user.Password.Trim(); updateUser.Email = _user.Email.Trim(); bool checkUser = new UserBL().UpdateUser(updateUser, db); if (checkUser == true) { return(RedirectToAction("UserDashBoard", "User", new { msg = "Profile updated successfully", color = "green" })); } else { return(RedirectToAction("UserDashBoard", "User", new { msg = "Somethings' Wrong", color = "Red" })); } } catch { return(RedirectToAction("Error", "Auth", new { msg = "search for the page was not found", color = "Red" })); } }