public InvoiceApiModel AddInvoice(InvoiceApiModel newInvoiceApiModel) { var invoice = newInvoiceApiModel.Convert(); invoice = _invoiceRepository.Add(invoice); newInvoiceApiModel.InvoiceId = invoice.InvoiceId; return(newInvoiceApiModel); }
public async Task <InvoiceApiModel> AddInvoiceAsync(InvoiceApiModel newInvoiceApiModel, CancellationToken ct = default) { /*var invoice = new Invoice * { * CustomerId = newInvoiceApiModel.CustomerId, * InvoiceDate = newInvoiceApiModel.InvoiceDate, * BillingAddress = newInvoiceApiModel.BillingAddress, * BillingCity = newInvoiceApiModel.BillingCity, * BillingState = newInvoiceApiModel.BillingState, * BillingCountry = newInvoiceApiModel.BillingCountry, * BillingPostalCode = newInvoiceApiModel.BillingPostalCode, * Total = newInvoiceApiModel.Total * };*/ var invoice = newInvoiceApiModel.Convert(); invoice = await _invoiceRepository.AddAsync(invoice, ct); newInvoiceApiModel.InvoiceId = invoice.InvoiceId; return(newInvoiceApiModel); }