示例#1
0
 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);
 }
示例#2
0
        public async Task UpdateInvoice(OrderHeaderDTO invoiceDto)
        {
            var updateInvice = new OrderHeder(invoiceDto);

            _context.OrderHeders.Update(updateInvice);
            _context.SaveChanges();
        }
示例#3
0
 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;
     }
 }
示例#4
0
        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"));
        }
示例#5
0
 public async Task Put(OrderHeaderDTO invoiceDto)
 {
     await _invoice.UpdateInvoice(invoiceDto);
 }
示例#6
0
 public async Task Post(OrderHeaderDTO invoiceDto)
 => await _invoice.AddInvoice(invoiceDto);