示例#1
0
        public void RemoveRecipe(int id)
        {
            RecipeVO recipeVo = ActiveRecordBase <RecipeVO> .Find(id);

            recipeVo.Delete();
            eventMessenger.Publish(new RecipesUpdatedEvent());
        }
示例#2
0
        public void AddRecipe(Recipe recipe)
        {
            RecipeVO newRecipe = ToRecipeVO(recipe);

            newRecipe.Create();
            eventMessenger.Publish(new RecipesUpdatedEvent());
        }
示例#3
0
        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);
        }
示例#4
0
        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());
        }
示例#5
0
 public IEnumerable <Recipe> GetAllRecipes()
 {
     return(RecipeVO.FindAllRecipes().Select(ToRecipe));
 }