コード例 #1
0
ファイル: BookingController.cs プロジェクト: taruntomar/rfs
 // GET api/<controller>/5
 public HttpResponseMessage Get(string id)
 {
     if (IsAuth())
     {
         var booking = _bookingManager.GetBookingById(id);
         HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
         response.Content    = new ObjectContent <Booking>(booking, new JsonMediaTypeFormatter(), "application/json");
         response.StatusCode = HttpStatusCode.OK;
         return(response);
     }
     else
     {
         return(new HttpResponseMessage(HttpStatusCode.Unauthorized));
     }
 }
コード例 #2
0
        public IHttpActionResult GetBooking(int id)
        {
            var result = _bookingManager.GetBookingById(id);

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

            return(Ok(result));
        }