public async Task<InvoiceModel> EditInvoiceAsync(ClientInvoiceEditModel invoice, List<ClientInvoiceProductEditModel> clientInvoiceProducts, List<PartialTimesheetsEditModel> timesheets) { var invoiceDto = new InvoiceEditModel { ClientInvoice = invoice, ClientInvoiceProducts = clientInvoiceProducts, Timesheets = timesheets }; using (var client = new HttpClient()) { string invoiceDTOJson = JsonConvert.SerializeObject(invoiceDto); client.DefaultRequestHeaders.Authorization = HelperMethods.CreateAuthorizationHeader(_apiKey); var content = new StringContent(invoiceDTOJson, Encoding.UTF8, "application/json"); HttpResponseMessage response = await client.PutAsync(BaseRequestUri, content); string responseString = await response.Content.ReadAsStringAsync(); return JsonConvert.DeserializeObject<InvoiceModel>(responseString); } }
public async Task<InvoiceModel> EditInvoiceAsync(ClientInvoiceEditModel invoice, List<ClientInvoiceProductEditModel> clientInvoiceProducts) { var timesheets = new List<PartialTimesheetsEditModel>(); var result = await EditInvoiceAsync(invoice, clientInvoiceProducts, timesheets); return result; }