public async Task <IActionResult> Register(RegisterViewModel vm) { if (!ModelState.IsValid) { vm.States = dal.StateList(); vm.InterestRank = dal.InterestList(); return(View(vm)); } int locationid = dal.AddLocation(Convert.ToInt32(vm.ZipCode), vm.SelectedState, (vm.City).ToUpper()); var user = new User { Id = vm.Email_id, UserName = vm.Email_id, Email = vm.Email_id, First_name = vm.First_name, Last_name = vm.Last_name, PhoneNumber = vm.Mobile_number, Age = vm.Age, CreatedTimestamp = DateTime.Now, LocationId = locationid }; var result = await _userManager.CreateAsync(user, vm.Password); if (result.Succeeded) { dal.AddInterest(vm.NightVentures, vm.FoodVentures, vm.ArtandCultureVentures, vm.OutDoors, vm.Email_id); await _signInManager.SignInAsync(user, false); return(RedirectToAction("Index", "Home")); } else { foreach (var error in result.Errors) { ModelState.AddModelError("", error.Description); } } vm.InterestRank = dal.InterestList(); vm.States = dal.StateList(); return(View(vm)); }