Ejemplo n.º 1
0
        public async Task <IActionResult> PutMascota(int id, Mascota mascota)
        {
            if (id != mascota.MascotaId)
            {
                return(BadRequest());
            }

            string refugioId = ObtenerRefugioId().Result;

            if (mascota.Id_Refugio != refugioId)
            {
                return(Unauthorized());
            }

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

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

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutRefugio(int id, Refugio refugio)
        {
            if (id != refugio.RefugioId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }