Example #1
0
		public async Task AddDishAsync(Dish dish)
		{
			var items = await _dishStorage.GetItems();
			var list = items.ToList();
			list.Add(dish);

			await _dishStorage.Store(list);
		}
Example #2
0
		public async Task UpdateDishAsync(string name, Dish newDish)
		{
			var items = await _dishStorage.GetItems();
			var list = items.ToList();
			var currentComponent = list.FirstOrDefault(x => x.Name == name);

			if (currentComponent == null)
			{
				throw new Exception("Item not found");
			}

			list.Remove(currentComponent);
			list.Add(newDish);

			await _dishStorage.Store(list);
		}