Example #1
0
 public HttpResponseMessage Find(Guid Id)
 {
     try
     {
         var question = questionLogic.Find(Id);
         if (question == null)
         {
             throw new NoSuchQuestionFound();
         }
         HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, new { question });
         return(response);
     }
     catch (NoSuchQuestionFound e)
     {
         HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, new { error = e.Message });
         return(response);
     }
     catch (Exception e)
     {
         HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.BadRequest, e.Message);
         return(response);
     }
 }