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" }); }
public void RemoveFromCustomBentoBox(Dish dish) { var customBentoBoxItem = CustomBentoBoxItems.SingleOrDefault(i => i.DishId == dish.DishId); if (customBentoBoxItem != null) { CustomBentoBoxItems.Remove(customBentoBoxItem); } }
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; } }
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; }
/// <summary> /// Deprecated Method for adding a new object to the Dishes EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToDishes(Dish dish) { base.AddObject("Dishes", dish); }
/// <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; }