public async Task <IActionResult> PutImportInvoice(string id, ImportInvoice importInvoice) { if (id != importInvoice.Id) { return(BadRequest()); } _context.Entry(importInvoice).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ImportInvoiceExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <ImportInvoice> > PostImportInvoice(ImportInvoice importInvoice) { _context.ImportInvoice.Add(importInvoice); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (ImportInvoiceExists(importInvoice.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetImportInvoice", new { id = importInvoice.Id }, importInvoice)); }