Ejemplo n.º 1
0
        public JsonResult ShowMenus(Int32 checkId) {
            List<CheckMenuItem> Menus = new List<CheckMenuItem>();
            CheckMenuItem menu;

            try {
                List<Services.ChecksMenu> menus = _orderService.GetMenuItems(checkId);
                foreach (Services.ChecksMenu menuItem in menus) {
                    Services.Item item = _itemService.GetItem(menuItem.MenuId);
                    menu = new CheckMenuItem();
                    menu.CheckId = checkId;
                    menu.id = menuItem.id;
                    menu.ItemId = item.id;
                    menu.Name = item.Name;
                    menu.Description = item.Description;
                    menu.Price = (Decimal)item.ItemPrices.OrderByDescending(m => m.DateCreated).Take(1).Select(m => m.Price).FirstOrDefault();
                    menu.HasProducts = (_orderService.GetProducts(menu.id).Count() > 0);
                    menu.Ordered = ((Common.MenuItemStatus)menuItem.Status == Common.MenuItemStatus.Ordered);
                    Menus.Add(menu);
                }
            }
            catch (Exception ex) {
                base.Log(ex);
                return null;
            }
            finally {
            }

            var retVal = new {
                html = RenderViewToString(this.ControllerContext, "_OrderMenusPartial", Menus),
                checkId = checkId
            };
            return new JsonResult() { Data = retVal, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
        }
Ejemplo n.º 2
0
        public String ShowMenuItem(Int32 id, ChecksMenu menuItem) {
            CheckMenuItem menu = new CheckMenuItem();

            try {
                Services.Item Item = _itemService.GetItem(id);
                menu.id = menuItem.id;
                menu.ItemId = Item.id;
                menu.Name = Item.Name;
                menu.CheckId = menuItem.CheckId;
                menu.Price = (Decimal)Item.ItemPrices.OrderByDescending(m => m.DateCreated).Take(1).Select(m => m.Price).FirstOrDefault();
                menu.HasProducts = (_orderService.GetProducts(menu.id).Count() > 0);
            }
            catch (Exception ex) {
                base.Log(ex);
                return String.Empty;
            }

            return RenderViewToString(this.ControllerContext, "_OrderMenuItemPartial", menu);
        }