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>(); var registration = Mapper.Map<DTO.Registration>(model); string registrationId = DAL.Registration.Register(registration).ToString(); if (string.IsNullOrWhiteSpace(registrationId)) { return Json(false); } var email = new SignUpEmail(registration, registrationId); await email.SendAsync(); return Json(true); }
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)); }