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()); }
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)); }