public MenuDecorator PrepareBurger(Burger burger, Drink drink, MenuSize menuSize) { try { Menu menu = new Menu(); menu.AddItem(burger); menu.AddItem(drink); switch (menuSize) { case MenuSize.SMALL: default: return(new SmallDecorator(menu)); case MenuSize.NORMAL: return(new NormalDecorator(menu)); case MenuSize.BIG: return(new BigDecorator(menu)); } } catch (Exception e) { LoggerSingleton.Logger.LogError(e); return(null); } }
public static string ToText(this MenuSize size) { if (size.IsNullOrDefault()) { return("size-110"); } switch (size) { case MenuSize.Size100: return("size-100"); case MenuSize.Size110: return("size-110"); case MenuSize.Size125: return("size-125"); case MenuSize.Size150: return("size-150"); case MenuSize.Size175: return("size-175"); case MenuSize.Size200: return("size-200"); } return("size-110"); }
public async Task <MenuSize> Add(MenuSize model) { var entity = _menuSizeRepository.Add(model); await _menuSizeRepository.SaveChangeAsync(); return(model); }
public async Task <bool> Put(MenuSize model) { var result = false; if (ModelState.IsValid) { result = await _menuSizeBusiness.Update(model); } return(result); }
public async Task <int> Post(MenuSize model) { var result = 0; if (ModelState.IsValid) { model.Status = 1; var modelInsert = await _menuSizeBusiness.Add(model); result = modelInsert.Id; } return(result); }
public Menu( string title = "MenuV", string subtitle = "", MenuPosition position = MenuPosition.TopLeft, int red = 0, int green = 0, int blue = 255, MenuSize size = MenuSize.Size110, string texture = "default", string dictionary = "menuv") : this(title, subtitle, position, Color.FromArgb(red, green, blue), size, texture, dictionary) { }
private void AddToOrder_Click(object sender, RoutedEventArgs e) { DrinkType drinkType = (DrinkType)Convert.ToInt32(SelectedDrinkType.SelectedValue); BurgerType burgerType = (BurgerType)Convert.ToInt32(SelectedBurgerType.SelectedValue); MenuSize menuSize = (MenuSize)Convert.ToInt32(SelectedMenuSize.SelectedValue); IMenuFactory menuFactory = new MenuFactory(); var menu = builder.PrepareBurger(menuFactory.GetBurger(burgerType), menuFactory.GetDrink(drinkType), menuSize); currentOrder.AddMenu(menu); ReinitOrderSource(); }
public async Task <bool> Update(MenuSize model) { var result = false; var record = await _menuSizeRepository.Repo.FirstOrDefaultAsync(c => c.Id == model.Id); if (record != null) { record.Name = model.Name; await _menuSizeRepository.SaveChangeAsync(); result = true; } return(result); }
public Menu( string title = "MenuV", string subtitle = "", MenuPosition position = MenuPosition.TopLeft, Color color = new Color(), MenuSize size = MenuSize.Size110, string texture = "default", string dictionary = "menuv") { this.IsOpen = false; this.UUID = Guid.NewGuid(); this.Title = title; this.Subtitle = subtitle; this.Position = position; this.Color = color.IsNullOrDefault() ? Color.FromArgb(0, 0, 255) : color; this.Size = size; this.Texture = string.IsNullOrWhiteSpace(texture) ? "default" : texture; this.Dictionary = string.IsNullOrWhiteSpace(dictionary) ? "menuv" : dictionary; }
public static IMenu CreateMenu( string title = "MenuV", string subtitle = "", MenuPosition position = MenuPosition.TopLeft, int red = 0, int green = 0, int blue = 255, MenuSize size = MenuSize.Size110, string texture = "default", string dictionary = "menuv") { var menu = new Menu(title, subtitle, position, red, green, blue, size, texture, dictionary); if (Main.Menus.ContainsKey(menu.UUID)) { Main.Menus[menu.UUID] = menu; } else { Main.Menus.Add(menu.UUID, menu); } return(menu); }