public ActionResult Register(RegisterModel UserDetails) { ViewBag.Message = null; if (ModelState.IsValid) { Employee employee = ManageAccount.GetEmployee(UserDetails.UserName); if (employee != null) { ViewBag.Message = "This username is already registered!"; return(View()); } employee = ManageAccount.GetEmployee(null, null, UserDetails.EMPID); if (employee != null) { ViewBag.Message = "This Employee ID is already registered!"; return(View()); } employee = ManageAccount.GetEmployee(null, null, null, UserDetails.EmailId); if (employee != null) { ViewBag.Message = "This EmailId is already registered!"; return(View()); } UserDetails.Password = PasswordHelper.EncryptData(UserDetails.Password); ManageAccount.SaveUser(UserDetails); ViewBag.Message = "Congrats! You are successfully registered. Admin will verify your account details and activate it soon."; //Session["username"] = UserDetails.UserName; //return RedirectToAction("DisplayPriority", "EmployeePriority"); } return(View()); }