public IHttpActionResult DeleteRecipe(int id) { RecipeDataAccess da = new RecipeDataAccess(); da.DeleteRecipe(id, GetUserId()); return(Ok()); }
public IHttpActionResult Post([FromBody] Recipe recipe) { RecipeDataAccess da = new RecipeDataAccess(); da.AddRecipe(recipe, GetUserId()); return(Ok()); }
protected void Application_Start() { GlobalConfiguration.Configure(WebApiConfig.Register); RecipeDataAccess da = new RecipeDataAccess(); da.AddMockRecipes(); }
public IHttpActionResult GetRecipe(int id) { RecipeDataAccess da = new RecipeDataAccess(); Recipe result = da.GetRecipe(id, GetUserId()); if (result != null) { return(Ok(result)); } return(NotFound()); }
public IHttpActionResult GetRecipe() { RecipeDataAccess da = new RecipeDataAccess(); IEnumerable <Recipe> result = da.GetAllRecipes(GetUserId()); if (result.Count() > 0) { return(Ok(result)); } return(NotFound()); }