public override Task <ICreateMenuItemResult> Work(CreateMenuItemCmd Op, Unit state)
        {
            MenuItem newMenuItem = new MenuItem()
            {
                Name = Op.Name, Ingredients = Op.Ingredients, Allergens = Op.Allergens, TotalQuantity = Op.TotalQuantity, Price = Op.Price, Availability = Op.Availability, MenuId = Op.Menu.Id
            };                                                                                                                                                                                                                         // Create a new MenuItem

            //if (Exists(Op.Menu, newMenuItem))
            //{
            //    return Task.FromResult<ICreateMenuItemResult>(new MenuItemNotCreated($"This menu item already exists in Menu: {Op.Menu.Id}, Restaurant: {Op.Menu.RestaurantId}!"));
            //}
            //else
            //{
            MenuItemAgg newMenuItemAgg = new MenuItemAgg(newMenuItem);

            return(Task.FromResult <ICreateMenuItemResult>(new MenuItemCreated(newMenuItemAgg)));
            //}
        }
 public MenuItemCreated(MenuItemAgg menuItem)
 {
     MenuItem = menuItem;
 }
 public MenuItemSelected(MenuItemAgg menuItemAgg)
 {
     MenuItemAgg = menuItemAgg;
 }
 public MenuItemChanged(MenuItemAgg newMenuItem)
 {
     NewMenuItem = newMenuItem;
 }
Пример #5
0
 public MenuItemFound(MenuItemAgg agg)
 {
     Agg = agg;
 }