public async Task <ActionResult <DegreeInfo> > PostDegreeInfo(DegreeInfo degreeInfo) { _context.degreeInfos.Add(degreeInfo); await _context.SaveChangesAsync(); return(CreatedAtAction("GetDegreeInfo", new { id = degreeInfo.Id }, degreeInfo)); }
public async Task <IActionResult> PutDegreeInfo(int id, DegreeInfo degreeInfo) { if (id != degreeInfo.Id) { return(BadRequest()); } _context.Entry(degreeInfo).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DegreeInfoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }