Exemple #1
0
        public async Task <IActionResult> PutMascotasTipo(int id, [FromBody] MascotasTipo mascotastipo)
        {
            if (id != mascotastipo.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #2
0
        public async Task <IActionResult> PatchMascotasTipo(int id, [FromBody] JsonPatchDocument <MascotasTipo> MascotasTipoPatch)
        {
            MascotasTipo mascotasTipo = await _context.MascotasTipo.FirstOrDefaultAsync(u => u.Id == id);

            if (mascotasTipo == null)
            {
                return(NotFound());
            }

            try
            {
                MascotasTipoPatch.ApplyTo(mascotasTipo);

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

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

            return(NoContent());
        }
Exemple #3
0
        public async Task <ActionResult <Mascotas> > PostMascotasTipo(MascotasTipo mascotasTipo)
        {
            _context.MascotasTipo.Add(mascotasTipo);

            await _context.SaveChangesAsync();

            return(Ok());
        }