public ActionResult Login(string username, string password) { if (LaboratoryDAL.ValidateUser(username, password)) { TempData["username"] = username; return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Invalid Username OR Password"); return(View()); } }
public ActionResult Create_Post() { // Retrieve form data using form collection Laboratory laboratory = new Laboratory(); TryUpdateModel(laboratory); if (ModelState.IsValid) { if (LaboratoryDAL.Insert(laboratory)) { return(RedirectToAction("Login")); } else { ModelState.AddModelError("", "Username already exists"); return(View()); } } else { return(View()); } }