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 }; }
public ShoppingListUpdater UpdateItem(ShoppingListItem item, ShoppingListItemUpdater updater) { updateQueue.Add(updater); return this; }
public ShoppingListUpdater UpdateItem(ShoppingListItem item, Func<ShoppingListItemUpdateAction, ShoppingListItemUpdateAction> updateAction) { var action = ShoppingListItemUpdater.Create(item); var result = updateAction(action); updateQueue.Add(result.Updater); return this; }
public ShoppingListUpdater RemoveItem(ShoppingListItem item) { removeQueue.Add(item); return this; }
public ShoppingListItemUpdater(ShoppingListItem item) { this.Item = item; }