Esempio n. 1
0
        public IActionResult GetMenu([FromQuery] int pageIndex, int pageSize, string groupName)
        {
            try
            {
                var stopwatch = StopwatchLogger.Start(_log);
                _log.Info("Called MenuController GetMenu");

                List <MenuItem> menus = new List <MenuItem>();

                try
                {
                    //var tenantId = new Guid("1C083115-7DB3-4B92-A449-D57FD1D2A52A");
                    menus = _iMenuManager.GetMenu(TenantCode, groupName, pageIndex, pageSize);
                    //menus = _iMenuManager.GetMenu(tenantId, groupName, pageIndex, pageSize);
                }
                catch (Exception ex)
                {
                    _log.Error(ExceptionFormatter.SerializeToString(ex));
                    return(BadRequest("Incorrect Type."));
                }

                stopwatch.StopAndLog("GetMenu of MenuController");

                var settings = new JsonSerializerSettings();
                settings.NullValueHandling = NullValueHandling.Ignore;
                settings.ContractResolver  = new CamelCasePropertyNamesContractResolver();
                return(Json(menus, settings));
            }
            catch (Exception ex)
            {
                _log.Error(ExceptionFormatter.SerializeToString(ex));
                return(StatusCode((int)HttpStatusCode.InternalServerError, ApiConstant.CustomErrorMessage));
            }
        }
Esempio n. 2
0
        public IActionResult Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var menu = _menuManager.GetMenu(id.Value);

            if (menu == null)
            {
                return(NotFound());
            }

            MenuDetailViewModel vm = new MenuDetailViewModel
            {
                ID        = menu.ID,
                Email     = menu.Owner.Email,
                Naam      = menu.Naam,
                menuItems = _menuItemManager.GetMenuItems(menu.ID)
            };

            return(View(vm));
        }
Esempio n. 3
0
        public QuoteSummaryVm CalculateQuote(CalculateQuoteModel model)
        {
            //Todo: need to have data driven engine here for calculating prices
            //Todo: The menu needs to have a 1 to many relationship with GuestNumberTypes (new table)
            //Todo: which is linked to each menu by venue also and has a calculation factor for price reductions
            //Todo: for now this is being hard coded
            var returnModel = new QuoteSummaryVm();
            var package     = _priceTariffManager.GetPackage(model.WeddingDate, model.VenueId);

            //returnModel.VenueName = package.
            returnModel.VenuePrice  = package.Price;
            returnModel.VenueName   = _venueManager.GetVenue(model.VenueId).name;
            returnModel.WeddingDate = model.WeddingDate;
            foreach (var sectionId in model.MenuSections)
            {
                var menu = _menuManager.GetMenu(sectionId);
                switch (menu.Id)
                {
                case 1:
                    menu.Price = CalculateBreakfast(menu.Price, model.AdultNumbers, model.TeenNumbers,
                                                    model.ChildNumbers);
                    break;

                case 2:
                    menu.Price = CalculateDrinks(menu.Price, model.AdultNumbers);
                    break;

                case 3:
                case 5:
                    menu.Price = CalculateEvening(menu.Price, model.EveningNumbers);
                    break;

                case 4:
                    menu.Price = CalculateCanape(menu.Price, model.AdultNumbers, model.TeenNumbers);
                    break;
                }
                returnModel.Menus.Add(menu);
            }

            return(returnModel);
        }
 public List <IMenuItem> GetMainMenu()
 {
     return(_mainMenuManager.GetMenu());
 }