public ActionResult UserRequests(int id, string type) { if (id != 0 && !string.IsNullOrEmpty(type) && type != "0") { try { var userRequest = UserRequestsRepo.LoadRequests().Data.FirstOrDefault(d => d.ID == id); var userInfo = new UserInfo() { Address = userRequest.Address, Email = userRequest.Email, Name = userRequest.Name, Password = userRequest.Password, UserName = userRequest.UserName, UserTypeID = Int32.Parse(type) }; UserInfoRepo.Save(userInfo); UserRequestsRepo.deleteRequest(id); new Thread(() => { Thread.CurrentThread.IsBackground = true; /* run your code here */ ForgotPassword.ConfirmationMail(userRequest.Email, userRequest.Name, "Your account has been created Successfully. Please go to the following link to continue.", userRequest.UserName, userRequest.Password); }).Start(); //TempData["ConfirmationMsg"] = "A confirmation mail has been sent"; } catch (Exception ex) { } } return(JavaScript("location.reload(true)")); }