Пример #1
0
        public async Task <IActionResult> PutRaza(int id, Raza item)
        {
            if (id != item.Id)
            {
                return(BadRequest());
            }

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

            return(NoContent());
        }
Пример #2
0
        public async Task <IActionResult> PutMascota(int id, Mascota item)
        {
            if (id != item.Id)
            {
                return(BadRequest());
            }

            Raza raza = await _baseDatos.Razas.FirstOrDefaultAsync(q => q.Id == item.RazaId);

            if (raza == null)
            {
                return(NotFound("La Raza no existe"));
            }

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

            return(NoContent());
        }