예제 #1
0
        public async Task <ActionResult <BillTotals> > PostBillTotals(BillTotals billTotals)
        {
            _context.BillTotals.Add(billTotals);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetBillTotals", new { id = billTotals.Id }, billTotals));
        }
예제 #2
0
        public async Task <IActionResult> PutBillTotals(int id, BillTotals billTotals)
        {
            if (id != billTotals.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }