public ActionResult ChangePassword(FormCollection form) { string EnteredOldPassword = form["old-password"]; string EnteredNewPassword = form["new-password"]; string EnteredConfirmPassword = form["confirm-password"]; if (!(EnteredOldPassword.Length > 0) || !(EnteredNewPassword.Length > 0) || !EnteredConfirmPassword.Equals(EnteredNewPassword)) { CheckFields(form); } else if (EnteredNewPassword.Length < 8 || EnteredNewPassword.Length > 16) { CheckFields(form); } else if (!LoginViewModel.IsValid(EnteredNewPassword)) { ViewBag.Np = true; ViewBag.NPasswordError = "Password invalid. Password must contain one special character, upper case, lower case and it should be alphanumeric"; return(View("ChangePassword")); } else { model.ChangePassword(form); return(View("ChangePassword", model)); } return(View("ChangePassword")); }