public ActionResult Create(Customer customer) { if (string.IsNullOrEmpty(customer.userName)) { ModelState.AddModelError("userName", "Required"); } if (string.IsNullOrEmpty(customer.userGender)) { ModelState.AddModelError("userGender", "Required"); } if (string.IsNullOrEmpty((customer.userPhone).ToString())) { ModelState.AddModelError("userPhone", "Required"); } if (string.IsNullOrEmpty((customer.country).ToString())) { ModelState.AddModelError("country", "Required"); } if (string.IsNullOrEmpty(customer.userId)) { ModelState.AddModelError("userId", "Required"); } if (string.IsNullOrEmpty(customer.userPassword)) { ModelState.AddModelError("userPassword", "Required"); } if (ModelState.IsValid) { TryUpdateModel(customer); busRepository.AddUser(customer); TempData["Message"] = "Welcome"; return(RedirectToAction("Login", "BusApp")); } return(View()); }