示例#1
0
        public async Task <ActionResult <ReservaItem> > PostReservaItem(ReservaItem item)
        {
            _context.ReservaItems.Add(item);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetReservaItem), new { id = item.Id }, item));
        }
示例#2
0
        public async Task <ActionResult <ReservaItem> > PostReservaItem(ReservaItem item)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            _context.ReservaItems.Add(item);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetReservaItem), new { id = item.Id }, item));
        }
示例#3
0
        public async Task <IActionResult> PutReservaItem(int id, ReservaItem item)
        {
            if (id != item.Id)
            {
                return(BadRequest());
            }

            _context.Entry(item).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(NoContent());
        }