static int OrderCount(Customer customer, string region) { throw new NotImplementedException(); }
static int OrderCount(Customer customer, string region) { throw new InvalidOperationException(); }
public async Task <ActionResult> _RegisterFormPartial_Search(string firstName, string lastName, string email, string address, string city, string state, string zip, string phone, string password) { RegisterViewModel model = new RegisterViewModel { FirstName = firstName, LastName = lastName, Email = email, Address = address, City = city, State = state, Zip = zip, Phone = phone, Password = password }; if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.Email, Email = model.Email }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); DataModel.Customer newUser = new DataModel.Customer { firstName = model.FirstName, lastName = model.LastName, email = model.Email, address = model.Address, city = model.City, state = model.State, zip = model.Zip, phone = model.Phone, sessionExpiration = System.DateTime.Now.AddMinutes(10) }; using (var context = new DataModel.HotelDatabaseContainer()) { context.People.Add(newUser); try { context.SaveChanges(); System.Diagnostics.Debug.WriteLine("Added new customer account!"); } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { System.Diagnostics.Debug.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { System.Diagnostics.Debug.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } throw; } } // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771 // Send an email with this link // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>"); return(Json(new { registered = "true" })); } AddErrors(result); } // If we got this far, something failed, redisplay form return(PartialView("_RegisterFormPartial")); }