Пример #1
0
        public IHttpActionResult DeleteRecipe(int id)
        {
            RecipeDataAccess da = new RecipeDataAccess();

            da.DeleteRecipe(id, GetUserId());
            return(Ok());
        }
Пример #2
0
        public IHttpActionResult Post([FromBody] Recipe recipe)
        {
            RecipeDataAccess da = new RecipeDataAccess();

            da.AddRecipe(recipe, GetUserId());
            return(Ok());
        }
Пример #3
0
        protected void Application_Start()
        {
            GlobalConfiguration.Configure(WebApiConfig.Register);

            RecipeDataAccess da = new RecipeDataAccess();

            da.AddMockRecipes();
        }
Пример #4
0
        public IHttpActionResult GetRecipe(int id)
        {
            RecipeDataAccess da     = new RecipeDataAccess();
            Recipe           result = da.GetRecipe(id, GetUserId());

            if (result != null)
            {
                return(Ok(result));
            }

            return(NotFound());
        }
Пример #5
0
        public IHttpActionResult GetRecipe()
        {
            RecipeDataAccess     da     = new RecipeDataAccess();
            IEnumerable <Recipe> result = da.GetAllRecipes(GetUserId());

            if (result.Count() > 0)
            {
                return(Ok(result));
            }

            return(NotFound());
        }