public async Task Put(OrderHeaderDTO productDto) { var content = new StringContent(JsonConvert.SerializeObject(productDto).ToString(), Encoding.UTF8, "application/json"); var client = _api.Initial(); await client.PutAsync("Invoices", content); }
public async Task UpdateInvoice(OrderHeaderDTO invoiceDto) { var updateInvice = new OrderHeder(invoiceDto); _context.OrderHeders.Update(updateInvice); _context.SaveChanges(); }
public async Task AddInvoice(OrderHeaderDTO invoiceDto) { try { var invoice = new OrderHeder(invoiceDto.CustomerId, invoiceDto.Lines); _context.OrderHeders.Add(invoice); _context.SaveChanges(); } catch (Exception e) { throw e; } }
public async Task <IActionResult> AddNew(List <Line> lines = null, Guid customerid = new Guid()) { var line = new List <OrderLineDTO>(); foreach (var item in lines) { Console.WriteLine(item.Id); Console.WriteLine(item.Price); line.Add(new OrderLineDTO { Price = item.Price, Quantity = 1, ProductNo = item.Id }); } var invoiceDto = new OrderHeaderDTO { CustomerId = customerid, Lines = line }; await _invoice.Post(invoiceDto); return(RedirectToAction("Index")); }
public async Task Put(OrderHeaderDTO invoiceDto) { await _invoice.UpdateInvoice(invoiceDto); }
public async Task Post(OrderHeaderDTO invoiceDto) => await _invoice.AddInvoice(invoiceDto);