public string Register(string UserId, string UserName, string JoiningDate, string Password, string EmailId, string PhoneNumber) { UserAccountDAL agent = new UserAccountDAL(); UserRegisterModel regUser = new UserRegisterModel(); regUser.EmployeeID = UserId; regUser.Name = UserName; regUser.DateOfJoining = Convert.ToDateTime(JoiningDate); regUser.PhoneNumber = PhoneNumber; regUser.EmailId = EmailId; regUser.Password = PasswordGenerator.EncryptPassword(Password); try { bool res = agent.NewUserRegister(regUser); if (res) { FormsAuthentication.SetAuthCookie(regUser.EmployeeID, false); Session["UserID"] = regUser.EmployeeID; Session["UserRole"] = "U"; return "DONE"; } else { //ModelState.AddModelError("", "The user name or password provided is incorrect."); //return View(regUser); return "ERROR: Registration incorrect"; } } catch { return "ERROR: Registration incorrect"; } }