public async Task <ActionResult> PostAsync(Registration model) { if (model.Password != model.ConfirmPassword) { throw new PasswordConfirmException("Passwords do not match."); } if (model.Email != model.ConfirmEmail) { throw new PasswordConfirmException("Passwords do not match."); } model.Browser = this.RemoteUser.Browser; model.IpAddress = this.RemoteUser.IpAddress; Mapper.CreateMap <Registration, DTO.Registration>(); DTO.Registration registration = Mapper.Map <DTO.Registration>(model); string registrationId = DAL.Registration.Register(registration).ToString(); if (string.IsNullOrWhiteSpace(registrationId)) { return(Json(false)); } SignUpEmail email = new SignUpEmail(registration, registrationId); await email.SendAsync(); return(Json(true)); }
public async Task <ActionResult> ConfirmAsync(string token) { Guid id = token.To <Guid>(); if (!DAL.Registration.ConfirmRegistration(id)) { return(View(GetRazorView <AreaRegistration>("SignUp/InvalidToken.cshtml"))); } DTO.Registration registration = DAL.Registration.Get(id); WelcomeEmail email = new WelcomeEmail(registration); await email.SendAsync(); return(View(GetRazorView <AreaRegistration>("SignUp/Welcome.cshtml"))); }