public async Task <IActionResult> PutSalesInvoice_Headers(int id, SalesInvoice_Headers salesInvoice_Headers) { if (id != salesInvoice_Headers.ID) { return(BadRequest()); } _context.Entry(salesInvoice_Headers).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SalesInvoice_HeadersExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <SalesInvoice_Headers> > PostInvoiceHeaders(SalesInvoice_Headers invoiceHeaders, string invoice_no) { var invoiceHeader = _context.SalesInvoice_Headers.Where(g => g.Invoice_No == invoice_no).FirstOrDefault(); if (invoiceHeader == null) { _context.SalesInvoice_Headers.Add(invoiceHeaders); await _context.SaveChangesAsync(); return(CreatedAtAction("GetInvoiceHeaders", new { id = invoiceHeaders.ID }, invoiceHeaders)); } else { return(Ok("Duplicate")); } }
public async Task <ActionResult <SalesInvoice_Headers> > PostSalesInvoice_Headers(SalesInvoice_Headers salesInvoice_Headers) { _context.SalesInvoice_Headers.Add(salesInvoice_Headers); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSalesInvoice_Headers", new { id = salesInvoice_Headers.ID }, salesInvoice_Headers)); }