public async Task <IActionResult> PutGrupoCarrera(int id, GrupoCarrera grupoCarrera) { if (id != grupoCarrera.idgrupo) { return(BadRequest()); } _context.Entry(grupoCarrera).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GrupoCarreraExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <GrupoCarrera> > PostGrupoCarrera(GrupoCarrera grupoCarrera) { _context.GrupoCarrera.Add(grupoCarrera); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (GrupoCarreraExists(grupoCarrera.idgrupo)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetGrupoCarrera", new { id = grupoCarrera.idgrupo }, grupoCarrera)); }