public bool Create(IDish dish) { var dishDic = new Dictionary <string, object> { { "Name", dish.Name } }; var success = HelpFunctions.nonQuery("Dish_Insert", dishDic); if (success) { foreach (var dishData in dish.ArticleDishes) { var articleDishDic = new Dictionary <string, object>(); articleDishDic.Add("Amount", dishData.Amount); articleDishDic.Add("Article_Id", dishData.Article.Id); articleDishDic.Add("Dish_Id", Read(dish)); HelpFunctions.nonQuery("ArticleDish_Insert", articleDishDic); } } InstantiateContextSQL(); return(success); }
public RestaurantsController(IRestaurant context, IDish dish, ICategory cat, IMenu menu) { this._restRepo = context; this._dishRepo = dish; this._catRepo = cat; this._menuRepo = menu; }
public DishesController(IDish dish, IRestaurant rest, ICategory cat, IMenu menu) { _dishRepo = dish; this._restRepo = rest; this._catRepo = cat; this._menuRepo = menu; }
public void UpdateDish(int restaurantId, int dishId, IDish dish) { RestaurantEntity restaurantEntity = _dbContext .Restaurants .Include(r => r.Dishes) .FirstOrDefault(r => r.Id == restaurantId); if (restaurantEntity is null) { throw new NotFoundException("Restaurant not found."); } DishEntity dishEntity = restaurantEntity .Dishes .FirstOrDefault(d => d.Id == dishId); if (dishEntity is null) { throw new NotFoundException("Dish not found."); } dishEntity = _mapper.Map(dish, dishEntity); _dbContext.Dishes.Update(dishEntity); _dbContext.SaveChanges(); }
public Decorator(IDish <EType> decoratedObj, double price, double quantity, List <string> ingredients) { Quantity += quantity; Price += price; DecoratedObj = decoratedObj; SetDish(price, quantity, ingredients); }
public void Add(IDish dish) { dbContext.Dishes.Add(new Dish() { Name = dish.Name }); dbContext.SaveChanges(); }
public void AddSalt(IDish dish) { dish.Salt++; // first thing to notice: mutation, this method is not thread safe, // and not even any method reading from dish.Salt at this point! // the answer is not "fixing mutation" by adding Monitor.TryEnter or lock { } construct!!! System.Console.WriteLine("we added salt!"); }
public void AddPepper(IDish dish) { dish.Pepper++; System.Console.WriteLine("we added salt!"); // this method was created using copy-paste from the previous one: shame! // we can see it because the comment is still the old one! it happens, really. // ctrl-c tarararara ctrl-v! damn : ) }
public PizzaExtraTomatoesDecorator(IDish <EPizzaType> decoratedObj) : base( decoratedObj, Constants.PizzaExtraTomatoesPrice, Constants.PizzaExtraTomatoesQuantity, new List <string>(Constants.PizzaExtraTomatoesIngredients) ) { }
public void SaveDish(IDish dish) { if (dish == null) { throw new ArgumentNullException(nameof(dish)); } _dishRepository.Save(dish); }
protected override void AddSpecific(IDish dish, Topping?optionalTopping = null) { if (!optionalTopping.HasValue) { throw new ArgumentNullException(nameof(optionalTopping)); } dish.Topping = optionalTopping.Value; }
public SaladExtraSpicyDressingDecorator(IDish <ESaladType> decoratedObj) : base( decoratedObj, Constants.SaladExtraSpicyDressingPrice, Constants.SaladExtraSpicyDressingQuantity, new List <string>(Constants.SaladExtraSpicyDressingIngredients) ) { }
public PizzaExtraBaconDecorator(IDish <EPizzaType> decoratedObj) : base( decoratedObj, Constants.PizzaExtraBaconPrice, Constants.PizzaExtraBaconQuantity, new List <string>(Constants.PizzaExtraBaconIngredients) ) { }
public SaladExtraMozzarellaDecorator(IDish <ESaladType> decoratedObj) : base( decoratedObj, Constants.SaladExtraMozzarellaPrice, Constants.SaladExtraMozzarellaQuantity, new List <string>(Constants.SaladExtraMozzarellaIngredients) ) { }
public DrinkExtraLemonDecorator(IDish <EDrinkType> decoratedObj) : base( decoratedObj, Constants.DrinkExtraLemonPrice, Constants.DrinkExtraLemonQuantity, new List <string>(Constants.DrinkExtraLemonIngredients) ) { }
public PizzaChickenDecorator(IDish <EPizzaType> decoratedObj) : base( decoratedObj, EPizzaType.CHICKEN, Constants.PizzaChickenPrice, Constants.PizzaChickenQuantity, new List <string>(Constants.PizzaChickenIngredients) ) { }
public SaladVegetarianDecorator(IDish <ESaladType> decoratedObj) : base( decoratedObj, ESaladType.VEGETARIAN, Constants.SaladVegetarianPrice, Constants.SaladVegetarianQuantity, new List <string>(Constants.SaladVegetarianIngredients) ) { }
public Dish(IDish dish, DateTime dt, IList <DishItem> _DishItems) { WeightDish = dish.WeightDish; DishItems = _DishItems; NumberDoc = dish.NumberDoc; DateCreate = dt; NameDish = dish.NameDish; ExpandedNameDish = dish.ExpandedNameDish; NumberInCollectionOfRecipes = dish.NumberInCollectionOfRecipes; }
public SaladMediterraneanDecorator(IDish <ESaladType> decoratedObj) : base( decoratedObj, ESaladType.MEDITERRANEAN, Constants.SaladMediterraneanPrice, Constants.SaladMediterraneanQuantity, new List <string>(Constants.SaladMediterraneanIngredients) ) { }
public PizzaCapricciosaDecorator(IDish <EPizzaType> decoratedObj) : base( decoratedObj, EPizzaType.CAPRICCIOSA, Constants.PizzaCapricciosaPrice, Constants.PizzaCapricciosaQuantity, new List <string>(Constants.PizzaCapricciosaIngredients) ) { }
public DrinkCherrySodaDecorator(IDish <EDrinkType> decoratedObj) : base( decoratedObj, EDrinkType.CHERRY_SODA, Constants.DrinkCherrySodaPrice, Constants.DrinkCherrySodaQuantity, new List <string>(Constants.DrinkCherrySodaIngredients) ) { }
public DrinkOrangeJuiceDecorator(IDish <EDrinkType> decoratedObj) : base( decoratedObj, EDrinkType.ORANGE_JUICE, Constants.DrinkOrangeJuicePrice, Constants.DrinkOrangeJuiceQuantity, new List <string>(Constants.DrinkOrangeJuiceIngredients) ) { }
/// <summary> /// /// Create /// /// Right = Admin, Instructor /// /// Exception = validation /// /// </summary> public bool Add(int userId, IDish dish) { if (!UserLogic.CheckRight(userId, Right.Admin) || UserLogic.CheckRight(userId, Right.Instructor)) { return(false); } return(_repository.Add(dish)); }
public PizzaDiavolaDecorator(IDish <EPizzaType> decoratedObj) : base( decoratedObj, EPizzaType.DIAVOLA, Constants.PizzaDiavolaPrice, Constants.PizzaDiavolaQuantity, new List <string>(Constants.PizzaDiavolaIngredients) ) { }
public DrinkColaDecorator(IDish <EDrinkType> decoratedObj) : base( decoratedObj, EDrinkType.COLA, Constants.DrinkColaPrice, Constants.DrinkColaQuantity, new List <string>(Constants.DrinkColaIngredients) ) { }
public SaladCaesarDecorator(IDish <ESaladType> decoratedObj) : base( decoratedObj, ESaladType.CAESAR, Constants.SaladCaesarPrice, Constants.SaladCaesarQuantity, new List <string>(Constants.SaladCaesarIngredients) ) { }
private static DishDto InterfaceToDto(IDish dish) { var dishDto = new DishDto { Id = dish.Id, Name = dish.Name, ArticleDishes = dish.ArticleDishes }; return(dishDto); }
public Handler( IUserAuth userAuth, IDish dish, IIngredient ingredient, IRecipe recipe) { _ingredient = ingredient; _recipe = recipe;; _dish = dish; _userAuth = userAuth; }
public bool Update(IDish dish) { var parameters = new Dictionary <string, object> { { "Id", dish.Id }, { "Name", dish.Name } }; InstantiateContextSQL(); return(HelpFunctions.nonQuery("Dish_Update", parameters)); }
public void UpdateDish(IDish dish) { if (dish == null) { throw new ArgumentNullException(nameof(dish)); } var existingDish = GetDish(dish.id); UpdateDishFields(existingDish, dish); _dishDataAccess.SaveDish(existingDish); }
public bool IsCorrect(IDish dish, int? pos = null) { return rs.Take(pos.Value).Any(t => (t.Dish.Name.ToLower() != "coffee" || t.Dish.Name.ToLower() != "potato") && t.Dish.TypeId == dish.TypeId); }
public bool IsCorrect(IDish dish, int? pos = null) { return (dish.TypeId == 4 && dish.TimeofDay == "night"); }