Ejemplo n.º 1
0
 public IActionResult GetAll()
 {
     try
     {
         RecipeCore recipeCore = new RecipeCore(dbContext);
         return(Ok(recipeCore.GetAll()));
     }
     catch (Exception ex)
     {
         return(StatusCode((int)HttpStatusCode.InternalServerError, ex));
     }
 }
Ejemplo n.º 2
0
 public IActionResult GetAllFromUser([FromRoute] int id)
 {
     try
     {
         RecipeCore recipeCore = new RecipeCore(dbContext);
         return(Ok(recipeCore.GetAllFromUser(id)));
         // return "wdad";
     }
     catch (Exception ex)
     {
         return(StatusCode((int)HttpStatusCode.InternalServerError, ex));
     }
 }
Ejemplo n.º 3
0
        public IActionResult Create([FromBody] Recipe recipe)
        {
            try
            {
                RecipeCore recipeCore = new RecipeCore(dbContext);

                recipeCore.Create(recipe);

                return(Ok("recipe Added Succesfully"));
            }
            catch (Exception ex)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, ex));
            }
        }
Ejemplo n.º 4
0
        public IActionResult Delete([FromRoute] int id)
        {
            try
            {
                RecipeCore recipeCore = new RecipeCore(dbContext);

                recipeCore.Delete(id);

                return(Ok("recipe Word Deleted Succesfully"));
            }
            catch (Exception ex)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, ex));
            }
        }