public async Task <IActionResult> PutAttendanceDetails(int id, AttendanceDetails attendanceDetails) { if (id != attendanceDetails.AttendanceID) { return(BadRequest()); } _context.Entry(attendanceDetails).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AttendanceDetailsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutSubjectClass(int id, SubjectClass subjectClass) { if (id != subjectClass.SubjectClassID) { return(BadRequest()); } _context.Entry(subjectClass).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SubjectClassExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutEvent(int id, Event @event) { if (id != @event.EventID) { return(BadRequest()); } _context.Entry(@event).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EventExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ReturnResult <Student> > PutStudent(string id, Student student) { _context.Entry(student).State = EntityState.Modified; ReturnResult <Student> result = new ReturnResult <Student>(); try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudentExists(id)) { result.ErrorCode = HttpStatusCode.NotFound.ToString(); result.ErrorMessage = "Stundent not exists"; } else { throw; } } result.ErrorCode = HttpStatusCode.NotFound.ToString(); result.ErrorMessage = "No Content"; return(result); }