Exemplo n.º 1
0
 public ActionResult AddDish(string dishName, int dishTypeId, string imageName, decimal price, int restaurantId)
 {
     var dish = new Dish()
     {
         DishImageUrl = ConfigurationManager.AppSettings["DishImageFolder"] + imageName,
         IsOnVoting = false,
         RestaurantId = restaurantId,
         ShortDescription = "yummy",
         DetailedDescription = "yummy",
         DishStatusId = (int)DishStatusLevel.Available,
         DishTypeId = dishTypeId,
         DishName = dishName,
         DishIncrementalPrice = price
     };
     db.Dishes.AddObject(dish);
     db.SaveChanges();
     return Json(new { result = "Dish has been added, please hit F5" });
 }
Exemplo n.º 2
0
        public void RemoveFromCustomBentoBox(Dish dish)
        {
            var customBentoBoxItem = CustomBentoBoxItems.SingleOrDefault(i => i.DishId == dish.DishId);

            if (customBentoBoxItem != null)
            {
                CustomBentoBoxItems.Remove(customBentoBoxItem);
            }
        }
Exemplo n.º 3
0
        public void ChangeQuantity(Dish dish, int quantity)
        {
            var customBentoBoxItem = CustomBentoBoxItems.SingleOrDefault(i => i.DishId == dish.DishId);

            if (customBentoBoxItem == null)
            {
                customBentoBoxItem = new CustomBentoBoxItem
                {
                    DishId = dish.DishId,
                    Quantity = quantity
                };

                CustomBentoBoxItems.Add(customBentoBoxItem);
            }
            else
            {
                customBentoBoxItem.Quantity = quantity;
            }
        }
Exemplo n.º 4
0
        public bool AddToCustomBentoBox(Dish dish)
        {
            var customBentoBoxItem =  CustomBentoBoxItems.SingleOrDefault(i=>i.DishId == dish.DishId);

            if (customBentoBoxItem == null)
            {
                customBentoBoxItem = new CustomBentoBoxItem
                {
                    DishId = dish.DishId,
                    Quantity = 1
                };
                CustomBentoBoxItems.Add(customBentoBoxItem);
                return true;
            }
            return false;
        }
Exemplo n.º 5
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Dishes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDishes(Dish dish)
 {
     base.AddObject("Dishes", dish);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Create a new Dish object.
 /// </summary>
 /// <param name="dishId">Initial value of the DishId property.</param>
 /// <param name="dishName">Initial value of the DishName property.</param>
 /// <param name="dishStatusId">Initial value of the DishStatusId property.</param>
 /// <param name="dishIncrementalPrice">Initial value of the DishIncrementalPrice property.</param>
 /// <param name="isOnVoting">Initial value of the IsOnVoting property.</param>
 public static Dish CreateDish(global::System.Int32 dishId, global::System.String dishName, global::System.Int32 dishStatusId, global::System.Decimal dishIncrementalPrice, global::System.Boolean isOnVoting)
 {
     Dish dish = new Dish();
     dish.DishId = dishId;
     dish.DishName = dishName;
     dish.DishStatusId = dishStatusId;
     dish.DishIncrementalPrice = dishIncrementalPrice;
     dish.IsOnVoting = isOnVoting;
     return dish;
 }