public IActionResult New(SessionIndexModel model)
        {
            Index index = createIndexForUser();

            ViewData.Add("Docodo", docodo.getVersion());
            ViewResult res = View(new SessionIndexModel(index));

            ViewBag.Languages = docodo.getLanguages();

            switch (model.Type)
            {
            case SessionIndexModel.TypeEnum.Web:

                WebDataSource web = new WebDataSource("web", model.Path);
                web.MaxItems = 20;
                index.AddDataSource(web);
                index.CreateAsync();
                break;

            default:
                ViewData.Add("Error", $"Data Source {model.Type} is not supported");
                break;
            }


            return(res);
        }
Example #2
0
        public IActionResult Index(int id)
        {
            var session = _sessionService.GetAll();

            var listingResult = session
                                .Select(c => new SessionListingModel
            {
                Id                 = c.Id,
                SessionName        = c.SessionName,
                SessionImageUrl    = c.SessionImageUrl,
                ClassPriceNoMember = c.ClassPriceNoMember,
                ClassPriceMember   = c.ClassPriceMember,
            });

            var model = new SessionIndexModel()
            {
                SessionListing = listingResult
            };

            return(View(model));
        }