public async Task <IActionResult> PostEconomicalDisadvantagedGraduate([FromBody] EconomicalDisadvantagedGraduate economicalDisadvantagedGraduate) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.EconomicalDisadvantagedGraduate.Add(economicalDisadvantagedGraduate); await _context.SaveChangesAsync(); return(CreatedAtAction("GetEconomicalDisadvantagedGraduate", new { id = economicalDisadvantagedGraduate.EconomicalDisadvantagedGraduateId }, economicalDisadvantagedGraduate)); }
public async Task <IActionResult> PutEconomicalDisadvantagedGraduate([FromRoute] int id, [FromBody] EconomicalDisadvantagedGraduate economicalDisadvantagedGraduate) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != economicalDisadvantagedGraduate.EconomicalDisadvantagedGraduateId) { return(BadRequest()); } _context.Entry(economicalDisadvantagedGraduate).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EconomicalDisadvantagedGraduateExists(id)) { return(NotFound()); } else { throw; } } return(Ok(economicalDisadvantagedGraduate)); }