コード例 #1
0
        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));
        }
コード例 #2
0
        public async Task <IHttpActionResult> GetInterviewLoop(int id)
        {
            InterviewLoop interviewLoop = await db.InterviewLoops.FindAsync(id);

            if (interviewLoop == null)
            {
                return(NotFound());
            }

            return(Ok(interviewLoop));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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));
        }