public ActionResult LoginUser(UserLogin UL) { if (ModelState.IsValid) // Check the model state for any validation errors { MyService ObjService = new MyService(); if (ObjService.CheckUser(UL.Email, UL.Password)) { return(RedirectToAction("Index", "CandidateSignUp")); } else { ViewBag.Message = "Invalid Username or Password"; return(View()); } } else { return(View()); // Return the same view with validation errors. } }