예제 #1
0
        public HttpResponseMessage Get(int id)
        {
            Instructor instructor = _instructorService.GetInstructorById(id);

            if (instructor == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound, "Instructor not found"));
            }
            return(Request.CreateResponse(HttpStatusCode.OK, instructor));
        }
예제 #2
0
 public HttpResponseMessage GetInstructorById(int id)
 {
     if (id < 0)
     {
         return(Request.CreateResponse(HttpStatusCode.BadRequest));
     }
     else
     {
         var Instructor = _Instructorservice.GetInstructorById(id);
         if (Instructor != null)
         {
             return(Request.CreateResponse(HttpStatusCode.OK, Instructor));
         }
         else
         {
             return(Request.CreateResponse(HttpStatusCode.NotFound, "No Instructor for id " + id));
         }
     }
 }
예제 #3
0
        public ActionResult Update(int InstructorId)
        {
            var instructor = _service.GetInstructorById(InstructorId);

            return(View(instructor));
        }