Ejemplo n.º 1
0
        public async Task <ActionResult <MascotaItem> > PostMascotaItem(MascotaItem item)
        {
            _context.MascotaItems.Add(item);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetMascotaItem), new MascotaItem {
                Id = item.Id
            }, item));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutMascotaItem(int id, MascotaItem item)
        {
            if (id != item.Id)
            {
                return(BadRequest());
            }
            _context.Entry(item).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(NoContent());
        }