public async Task <IActionResult> PostGraduatesTotalExitExamination([FromBody] GraduatesTotalExitExamination graduatesTotalExitExamination) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.GraduatesTotalExitExamination.Add(graduatesTotalExitExamination); await _context.SaveChangesAsync(); graduatesTotalExitExamination = _context.GraduatesTotalExitExamination.Include(e => e.Department).FirstOrDefault(e => e.GraduatesTotalExitExaminationId == graduatesTotalExitExamination.GraduatesTotalExitExaminationId); return(CreatedAtAction("GetGraduatesTotalExitExamination", new { id = graduatesTotalExitExamination.GraduatesTotalExitExaminationId }, graduatesTotalExitExamination)); }
public async Task <IActionResult> PutGraduatesTotalExitExamination([FromRoute] int id, [FromBody] GraduatesTotalExitExamination graduatesTotalExitExamination) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != graduatesTotalExitExamination.GraduatesTotalExitExaminationId) { return(BadRequest()); } _context.Entry(graduatesTotalExitExamination).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GraduatesTotalExitExaminationExists(id)) { return(NotFound()); } else { throw; } } graduatesTotalExitExamination = _context.GraduatesTotalExitExamination.Include(e => e.Department).FirstOrDefault(e => e.GraduatesTotalExitExaminationId == graduatesTotalExitExamination.GraduatesTotalExitExaminationId); return(Ok(graduatesTotalExitExamination)); }