Exemplo n.º 1
0
        public IActionResult Index()
        {
            var exclude = new[] {
                S.ApplyText, S.ContactHeader, S.ContactPostHeader, S.ContactPreHeader, S.AutoNotificationDelayInMinutes, //general
                //S.OrderConfirmationEmailSubject, S.OrderNotificationEmails, S.OrderNotificationPhoneNumbers, S.OrderServiceText, //square
            };

            var _model = new Query.Settings.Get(_context).ExecuteAndReturnResults().Select(x => new Models.Settings.SettingModel(x));
            var model  = new List <Models.Settings.SettingModel>();

            foreach (var s in Seeds.Settings.Where(x => !exclude.Contains(x.Name)).Select(x => x.Name))
            {
                var setting = _model.FirstOrDefault(x => x.Name == s);
                if (setting != null)
                {
                    model.Add(setting);
                }
            }

            ViewData["Images"] = _imageHandler.GetAll().Select(x => new SelectListItem()
            {
                Text = x.Name, Value = x.Location
            });
            ViewData["LocationList"] = _locationHandler.GetAll().Select(x => new SelectListItem()
            {
                Text = x.Name, Value = x.Id.ToString()
            });

            return(View(model));
        }
        public Dictionary <string, List <SpecialModel> > Get()
        {
            var specials = _handler.GetAll(false).OrderBy(x => x.Begins).ThenBy(x => x.Name);
            var models   = new Dictionary <string, List <SpecialModel> >()
            {
                { "Sunday", specials.Where(x => x.IsSunday).ToList() },
                { "Monday", specials.Where(x => x.IsMonday).ToList() },
                { "Tuesday", specials.Where(x => x.IsTuesday).ToList() },
                { "Wednesday", specials.Where(x => x.IsWednesday).ToList() },
                { "Thursday", specials.Where(x => x.IsThursday).ToList() },
                { "Friday", specials.Where(x => x.IsFriday).ToList() },
                { "Saturday", specials.Where(x => x.IsSaturday).ToList() }
            };
            var sortedSpecials = new Dictionary <string, List <SpecialModel> >();

            foreach (var key in models.Keys)
            {
                if (!models[key].Any())
                {
                    models.Remove(key);
                }
            }
            foreach (var key in models.Keys)
            {
                var sorted = models[key].Where(x => !x.Name.Contains("happy hour", System.StringComparison.InvariantCultureIgnoreCase)).ToList();
                sorted.AddRange(models[key].Where(x => x.Name.Contains("happy hour", System.StringComparison.InvariantCultureIgnoreCase)).ToList());
                sortedSpecials.Add(key, sorted);
            }
            return(sortedSpecials);
        }
Exemplo n.º 3
0
 public IActionResult Edit(int id = 0)
 {
     ViewData["Locations"] = _locationHandler.GetAll().Select(x => new SelectListItem()
     {
         Text = x.Name, Value = x.Id.ToString()
     });
     return(View(_handler.Get(id)));
 }
Exemplo n.º 4
0
 public IActionResult Index(bool deleted = false)
 {
     ViewData["Deleted"] = deleted;
     return(View(new ImageIndexModel()
     {
         Images = _handler.GetAll(deleted)
     }));
 }
Exemplo n.º 5
0
        public IEnumerable <CategoryModel> Get()
        {
            var model = new MenuItemsModel(_handler.GetAll(false));

            model.Categories.ForEach(cat => {
                //cat.MenuItems.ForEach(item => item.Prices.ForEach(p => p.PriceTypeName = p.PriceTypeName.Replace(" ", "&nbsp;")));
                cat.MenuItems = cat.MenuItems.OrderBy(x => x.SortOrder).ToList();
            });

            //populate the options
            foreach (var combo in model.Categories.SelectMany(x => x.MenuItems).Where(x => x.ComboParts != null & x.ComboParts.Any()))
            {
                combo.ComboParts.ForEach(x => x.PopulateOptions(model.Categories));
            }

            return(model.Categories);
        }
Exemplo n.º 6
0
        public IActionResult Edit(int id = 0)
        {
            ViewData["Categories"] = _categoryHandler.GetAll().Select(x => new SelectListItem()
            {
                Text = x.Name, Value = x.Id.ToString()
            });
            ViewData["PriceTypes"] = JsonConvert.SerializeObject(_priceTypeHandler.GetAll().Select(x => new SelectListItem()
            {
                Text = x.Name, Value = x.Id.ToString()
            }));
            ViewData["Images"] = _imageHandler.GetAll().Select(x => new SelectListItem()
            {
                Text = x.Name, Value = x.Id.ToString()
            });

            return(View(new MenuItemModel()
            {
                Id = id
            }));
        }
 public IActionResult Index(bool deleted = false)
 {
     ViewData["Deleted"] = deleted;
     return(View(_handler.GetAll(deleted)));
 }
        public SettingsModel Get()
        {
            var system = new SystemModel(_handler.GetAll());

            return(new SettingsModel(_azureSettings, _squareLocations, system, _context));
        }
 public IActionResult Index(bool deleted = false)
 {
     return(View(new DeliveryDestinationsIndexModel(_handler.GetAll(deleted))));
 }