public void RemoveRecipe(int id) { RecipeVO recipeVo = ActiveRecordBase <RecipeVO> .Find(id); recipeVo.Delete(); eventMessenger.Publish(new RecipesUpdatedEvent()); }
public void AddRecipe(Recipe recipe) { RecipeVO newRecipe = ToRecipeVO(recipe); newRecipe.Create(); eventMessenger.Publish(new RecipesUpdatedEvent()); }
private RecipeVO ToRecipeVO(Recipe recipe) { RecipeVO curr = new RecipeVO(); curr.Id = recipe.Id; curr.Name = recipe.Name; curr.Grade = GradeConverter.Convert(recipe.Grade); curr.Image = recipe.Image; curr.Source = recipe.Source; curr.Url = recipe.Url; curr.Description = recipe.Description; return(curr); }
public void EditRecipe(Recipe recipe) { RecipeVO edited = ActiveRecordBase <RecipeVO> .Find(recipe.Id); edited.Description = recipe.Description; edited.Grade = GradeConverter.Convert(recipe.Grade); edited.Image = recipe.Image; edited.Name = recipe.Name; edited.Source = recipe.Source; edited.Url = recipe.Url; edited.SaveCopy(); eventMessenger.Publish(new RecipesUpdatedEvent()); }
public IEnumerable <Recipe> GetAllRecipes() { return(RecipeVO.FindAllRecipes().Select(ToRecipe)); }