Exemplo n.º 1
0
 public IHttpActionResult Get(int id, int opt)
 {
     try
     {
         using (var db = new RestaurantContext())
         {
             IHttpActionResult result = Content(HttpStatusCode.BadRequest, "Bad Second Parameter. available 1 (Ingredient) and 0 (Category)");;
             if (opt == 0)
             {
                 result = Ok(db.sp_cat_dishes(id).ToList());           //By Category
             }
             else if (opt == 1)
             {
                 result = Ok(db.sp_dish_by_ingredient(id).ToList());                //By Ingredient
             }
             return(result);
         }
     }
     catch (Exception e)
     {
         return(Content(HttpStatusCode.BadRequest, e.Message));
     }
 }