public ActionResult Index() { ViewBag.ReportList = "first active"; ApplicationHeaderViewModel model = new ApplicationHeaderViewModel(); return View(model); }
public ActionResult Index() { ViewBag.Setting = "first active"; ApplicationHeaderViewModel model = new ApplicationHeaderViewModel(); if (!User.IsInRole("Admin")) { return(RedirectToAction("UserProfile")); } return(View(model)); }
public ActionResult UserProfile(ApplicationHeaderViewModel model) { if (ModelState.IsValid) { var staff = StaffManager.GetById(model.Staff.kStaffId); model.Staff.kStaffPositionId = staff.kStaffPositionId; model.Staff.dtDateUpdate = DateTime.Now; StaffManager.Edit(model.Staff); ModelState.AddModelError("UserProfile", "success."); } else { ModelState.AddModelError("UserProfile", "failed."); } return(View(model)); }
public ActionResult UserPassword(ApplicationHeaderViewModel model) { if (ModelState.IsValid) { bool changePasswordSucceeded; try { MembershipUser currentUser = Membership.GetUser(User.Identity.Name, true /* userIsOnline */); changePasswordSucceeded = currentUser.ChangePassword(model.User.OldPassword, model.User.NewPassword); } catch (Exception) { changePasswordSucceeded = false; ModelState.AddModelError("", "failed."); } if (changePasswordSucceeded) { return(RedirectToAction("LogOff", "Account")); } else { ModelState.AddModelError("", "The current password is incorrect or the new password is invalid."); } } else { ModelState.AddModelError("", "failed."); } Guid id = (Guid)Membership.GetUser().ProviderUserKey; var users = StaffUserManager.GetUser(id); if (users != null) { model.User = new UserProfileChangePasswordModel { UserName = users[0].Username, OldPassword = users[0].Password }; } return(View(model)); }
public ActionResult UserProfile() { ViewBag.Settinguser = "******"; ApplicationHeaderViewModel model = new ApplicationHeaderViewModel(); Guid id = (Guid)Membership.GetUser().ProviderUserKey; model.Staff = StaffManager.GetById(id); var users = StaffUserManager.GetUser(id); if (users != null) { model.User = new UserProfileChangePasswordModel { UserName = users[0].Username, OldPassword = users[0].Password }; } return(View(model)); }