예제 #1
0
        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());
        }
예제 #2
0
        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));
        }