public async Task <IActionResult> Create(AccountRequestModelV7 model) { ActionResultV7 result = await this.service.Create(model); if (result.Success) { return(this.Ok(result.Object)); } else { return(this.StatusCode(400)); } }
public async Task <ActionResultV7> Create(AccountRequestModelV7 model) { ValidationResultV7 result = this.modelValidator.Validate(model); if (result.Success) { if (!await this.fbiService.VerifyWithFBI(model.SSN)) { return(new ActionResultV7(false, new ValidationResultV7(false, "Unable to validate with FBI"))); } var account = new Account(0, model.Name, model.SSN, DateTime.Now, model.Token); this.repository.Create(account); return(new ActionResultV7(true, account)); } else { return(new ActionResultV7(result)); } }