public ActionResult Login(LoginModel model) { if (ModelState.IsValid) { var currentUser = userDAL.GetUser(model.Username); if (currentUser == null) { ModelState.AddModelError("invalid-user", "The username provided does not match an existing user"); return(View("Login", model)); } else if (currentUser.Password != model.Password) { ModelState.AddModelError("invalid-password", "The password provided is not correct"); return(View("Login", model)); } base.LogUserIn(currentUser.Username); Session["isEmployee"] = currentUser.Is_Employee; if (currentUser.Is_Employee == 1) { return(RedirectToAction("ViewPotholesForEmp", "Home")); } else { return(RedirectToAction("Index", "Home")); } } else { return(RedirectToAction("Login", model)); } }
public ActionResult ClaimSubmit(DamageClaimModel claim) { if (CurrentUser == "EmptyUserName" || CurrentUser != "") { claim.Pothole_ID = (int)Session["Pothole_id"]; Users user = userDAL.GetUser(CurrentUser); claim.UserID = user.UserID; claimsDAL.NewClaim(claim); int claimID = claimsDAL.NewClaim(claim); Session["claimID"] = claimID; return(View("ClaimConfirmation", claim)); } else { return(RedirectToAction("Login", "User")); } }