public MyResponse UpdateIngredient(Ingredient ingredient, string userId) { MyResponse validateResult = ValidateUpdateIngredient(ingredient, userId); if (validateResult.IsSuccess()) { _ingredientsRepository.PutIngredient(ingredient); } return(validateResult); }
public MyResponse DeleteFavoriteRecipe(FavoriteRecipe favoriteRecipe) { MyResponse validateResult = ValidateDeleteFavoriteRecipe(favoriteRecipe); if (validateResult.IsSuccess()) { _recipesRepository.DeleteFavoriteRecipe(favoriteRecipe); } return(validateResult); }
public MyResponse DeleteRecipe(int id, string userId) { Recipe recipe = GetRecipe(id); MyResponse validateResult = ValidateDeleteRecipe(recipe, userId); if (validateResult.IsSuccess()) { _recipesRepository.DeleteRecipe(recipe); } return(validateResult); }
public MyResponse DeleteIngredient(int id, string userId) { Ingredient ingredient = GetIngredient(id); MyResponse validateResult = ValidateDeleteIngredient(ingredient, id, userId); if (validateResult.IsSuccess()) { _ingredientsRepository.DeleteIngredient(ingredient); } return(validateResult); }
public MyResponse DeleteRating(int recipeId, string userId) { Rating rating = _ratingsRepository.GetRating(recipeId, userId); MyResponse validateResult = ValidateDeleteRating(rating); if (validateResult.IsSuccess()) { _ratingsRepository.DeleteRating(rating); } return(validateResult); }
public MyResponse DeleteComment(int id, string userId) { Comment comment = _commentsRepository.GetComment(id); MyResponse validateResult = ValidateDeleteComment(comment, userId); if (validateResult.IsSuccess()) { _commentsRepository.DeleteComment(comment); } return(validateResult); }
public MyResponse DeleteRecipe(int id, string userId) { Recipe recipe = GetRecipe(id); MyResponse validateResult = ValidateDeleteRecipe(recipe, userId); if (validateResult.IsSuccess()) { _recipesRepository.DeleteRecipe(recipe); log.Info("UserId: " + userId + " deleted recipe with id: " + id); } return(validateResult); }
public MyResponse UpdateRecipe(Recipe recipe, string userId) { Recipe recipeFromDb = GetRecipe(recipe.Id); MyResponse validResult = ValidatePutRecipe(recipe, recipeFromDb, userId); if (validResult.IsSuccess()) { recipe.UserId = userId; recipe.CreatedOn = recipeFromDb.CreatedOn; _recipesRepository.PutRecipe(recipe); } return(validResult); }