public static ShoppingListItemUpdateAction Create(ShoppingListItem item)
        {
            var updater = new ShoppingListItemUpdater(item);
            var result = new ShoppingListItemUpdateAction(updater);

            return result;
        }
 public static ShoppingListItems FromShoppingListItem(ShoppingListItem item)
 {
     return new ShoppingListItems
     {
         ItemId = item.Id.HasValue ? item.Id.Value : Guid.NewGuid(),
         Raw = item.Raw,
         Qty = item.Amount == null ? null : (float?)item.Amount.SizeHigh,
         Unit = item.Amount == null ? null : (Units?)item.Amount.Unit,
         Ingredient = item.Ingredient == null ? null : new Ingredients { IngredientId = item.Ingredient.Id },
         Recipe = item.Recipe == null ? null : new Recipes { RecipeId = item.Recipe.Id },
         CrossedOut = item.CrossedOut
     };
 }
Example #3
0
 public ShoppingListUpdater UpdateItem(ShoppingListItem item, ShoppingListItemUpdater updater)
 {
     updateQueue.Add(updater);
      return this;
 }
Example #4
0
        public ShoppingListUpdater UpdateItem(ShoppingListItem item, Func<ShoppingListItemUpdateAction, ShoppingListItemUpdateAction> updateAction)
        {
            var action = ShoppingListItemUpdater.Create(item);
             var result = updateAction(action);

             updateQueue.Add(result.Updater);
             return this;
        }
Example #5
0
 public ShoppingListUpdater RemoveItem(ShoppingListItem item)
 {
     removeQueue.Add(item);
      return this;
 }
Example #6
0
 public ShoppingListItemUpdater(ShoppingListItem item)
 {
     this.Item = item;
 }