public async Task <IHttpActionResult> Post([FromBody] DTOCombineQuotation combineQuotation) { var customerExchangeResult = await _serviceParameter.CustomerExchangeService.GetCustomerExchangeByCustomerAndCarIdAsync(combineQuotation.CustomerId, combineQuotation.CarId); combineQuotation.Quotation.CustomerExchangeId = !customerExchangeResult.HasErrors ? customerExchangeResult.Target.Id : 0; return(await ExecuteServiceReturnDefaultResult(() => _serviceParameter.QuotationService.CreateQuotationAsync(combineQuotation.Quotation), false)); }
public async Task <IHttpActionResult> GetAllQuotationInfoById(string quotationId) { var combineQuotationDTO = new DTOCombineQuotation(); var errors = new List <ErrorDescriber>(); var quotationResult = await CallAsyncWithRetry(() => _serviceParameter.QuotationService.GetQuotationByIdAsync(quotationId)); if (quotationResult.HasErrors) { errors.AddRange(quotationResult.Errors); } var employeesResult = await CallAsyncWithRetry(() => _serviceParameter.QuotationService.GetEmployeesByQuotationIdAsync(quotationId)); if (employeesResult.HasErrors) { errors.AddRange(employeesResult.Errors); } var itemsResult = await CallAsyncWithRetry(() => _serviceParameter.QuotationService.GetQuotationItemsByQuotationIdAsync(quotationId)); if (itemsResult.HasErrors) { errors.AddRange(itemsResult.Errors); } if (errors.Count > 0) { var errorResult = ErrorResult(errors); return(Content(HttpStatusCode.InternalServerError, errorResult)); } combineQuotationDTO.Quotation = quotationResult.Target; combineQuotationDTO.Employees = employeesResult.Target; combineQuotationDTO.Items = itemsResult.Target; var successResult = SuccessResult(combineQuotationDTO); return(Ok(successResult)); }