public async Task <IHttpActionResult> PutInterviewLoop(int id, InterviewLoop interviewLoop) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != interviewLoop.InterviewLoopId) { return(BadRequest()); } db.Entry(interviewLoop).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InterviewLoopExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetInterviewLoop(int id) { InterviewLoop interviewLoop = await db.InterviewLoops.FindAsync(id); if (interviewLoop == null) { return(NotFound()); } return(Ok(interviewLoop)); }
public async Task <IHttpActionResult> PostInterviewLoop(InterviewLoop interviewLoop) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.InterviewLoops.Add(interviewLoop); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = interviewLoop.InterviewLoopId }, interviewLoop)); }
public async Task <IHttpActionResult> DeleteInterviewLoop(int id) { InterviewLoop interviewLoop = await db.InterviewLoops.FindAsync(id); if (interviewLoop == null) { return(NotFound()); } db.InterviewLoops.Remove(interviewLoop); await db.SaveChangesAsync(); return(Ok(interviewLoop)); }