public async Task <IActionResult> Register(VisitorViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var visitor = model.ToVisitor(); _dbContext.Add(visitor); await _dbContext.SaveChangesAsync(); return(RedirectToAction(nameof(Confirmation))); }
public async Task <IActionResult> Create([Bind("FirstName, LastName, BirthDate, Gender, ProfileId, CountryId")] VisitorViewModel vm) { if (ModelState.IsValid) { var Visitor = vm.ToVisitor(); var createOperation = await _bo.CreateAsync(Visitor); if (!createOperation.Success) { return(OperationErrorBackToIndex(createOperation.Exception)); } return(OperationSuccess("The visitor account was successfuly registered!")); } return(View(vm)); }