示例#1
0
        public async Task <HttpResponseMessage> GetAppleCrisp()
        {
            var response = new HttpResponseMessage(HttpStatusCode.OK);

            try
            {
                var result = await Task.Run(() => {
                    //Get the order details first:
                    var recipeDetail = Recipe.AppleCrisp();
                    return(recipeDetail);
                });

                response         = Request.CreateResponse(HttpStatusCode.OK);
                response.Content = new StringContent(result.ToJson(), System.Text.Encoding.UTF8, "application/json");
            }
            catch (Exception e)
            {
                response = Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Failed to get apple crisp recipe");
            }
            return(response);
        }
示例#2
0
 public Recipe GetRecipe()
 {
     return(Recipe.AppleCrisp());
 }