public IActionResult Index()
        {
            var path = Path.Combine(this.environment.WebRootPath, "Website Elements");
            AddSectionToPageViewModel viewModel = new AddSectionToPageViewModel
            {
                AllElements = this.addSectionToPageService.GetAllElements(path),
            };

            var model = new AddSectionToPageBaseModel
            {
                AddSectionToPageInputModel = new AddSectionToPageInputModel(),
                AddSectionToPageViewModel  = viewModel,
            };

            return(this.View(model));
        }
        public async Task <IActionResult> AddSectionToPage(AddSectionToPageBaseModel model)
        {
            if (this.ModelState.IsValid)
            {
                await this.addSectionToPageService.AddSectionToPage(model.AddSectionToPageInputModel);

                this.TempData["Success"] = string.Format(
                    MessageConstants.SuccessfullyAddSectionToPage,
                    model.AddSectionToPageInputModel.SectionType.ToString().ToUpper(),
                    model.AddSectionToPageInputModel.PageType.ToString().ToUpper());
            }
            else
            {
                this.TempData["Error"] = MessageConstants.InvalidInputModel;
                return(this.RedirectToAction("Index", "AddSectionToPage", model));
            }

            return(this.RedirectToAction("Index", "AddSectionToPage"));
        }