Ejemplo n.º 1
0
        public async Task <IActionResult> PutAgroupsub(int id, Agroupsub agroupsub)
        {
            if (id != agroupsub.Pgrp)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <Agroupsub> > PostAgroupsub(Agroupsub agroupsub)
        {
            _context.Agroupsubs.Add(agroupsub);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (AgroupsubExists(agroupsub.Pgrp))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetAgroupsub", new { id = agroupsub.Pgrp }, agroupsub));
        }