public IActionResult GetAll() { try { RecipeCore recipeCore = new RecipeCore(dbContext); return(Ok(recipeCore.GetAll())); } catch (Exception ex) { return(StatusCode((int)HttpStatusCode.InternalServerError, ex)); } }
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)); } }
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)); } }
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)); } }