public async Task <IActionResult> PutSubject([FromRoute] int id, [FromBody] Subject subject) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != subject.SubjectId) { return(BadRequest()); } try { _repo.Update(subject); var save = await _repo.SaveAsync(subject); } catch (DbUpdateConcurrencyException) { if (!SubjectExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutExamCenter([FromRoute] int id, [FromBody] ExamCenter center) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != center.CenterId) { return(BadRequest()); } try { _repo.Update(center); var save = await _repo.SaveAsync(center); } catch (DbUpdateConcurrencyException) { if (!CenterExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutRoom([FromRoute] int id, [FromBody] Room room) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != room.RoomId) { return(BadRequest()); } try { _repo.Update(room); var save = await _repo.SaveAsync(room); } catch (DbUpdateConcurrencyException) { if (!RoomExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutStandard([FromRoute] int id, [FromBody] StanderdClass standard) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != standard.ClassId) { return(BadRequest()); } try { _repo.Update(standard); var save = await _repo.SaveAsync(standard); } catch (DbUpdateConcurrencyException) { if (!StandardExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutNotice([FromRoute] int id, [FromBody] Notice notice) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != notice.NoticeID) { return(BadRequest()); } try { _repo.Update(notice); var save = await _repo.SaveAsync(notice); } catch (DbUpdateConcurrencyException) { if (!NoticeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }