public async Task <IHttpActionResult> PutQuestion(int id, Question question) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != question.QuestionId) { return(BadRequest()); } db.Entry(question).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!QuestionExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> PutTeacherBroadcast(int id, TeacherBroadcast teacherBroadcast) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != teacherBroadcast.teacherId) { return(BadRequest()); } db.Entry(teacherBroadcast).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeacherBroadcastExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }