Beispiel #1
0
        public async Task <ActionResult <ReceiptLine> > PostReceiptLine(ReceiptLine receiptLine)
        {
            _context.ReceiptLines.Add(receiptLine);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetReceiptLine", new { id = receiptLine.ReceiptLineId }, receiptLine));
        }
Beispiel #2
0
        public async Task <IActionResult> PutReceiptLine(int id, ReceiptLine receiptLine)
        {
            if (id != receiptLine.ReceiptLineId)
            {
                return(BadRequest());
            }

            _context.Entry(receiptLine).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ReceiptLineExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }