Beispiel #1
0
        public ActionResult Index()
        {
            var model = new CategoryAdminPage();

            model.ListCategoryType = EnumsExtensions.ListCategoryType();
            var rootPath = Server.MapPath("~/");

            var ndir = Server.MapPath("~/Views/Category/");

            if (Directory.Exists(ndir))
            {
                var files = Directory.GetFiles(ndir, "*.cshtml");
                model.ListCategoryViewName = files.Select(i => i.Replace(rootPath, "~/").Replace("\\", "/")).ToList();
            }
            else
            {
                model.ListCategoryViewName = new List <string>();
            }

            var pdir = Server.MapPath("~/Views/CategoryProduct/");

            if (Directory.Exists(pdir))
            {
                var pfiles = Directory.GetFiles(pdir, "*.cshtml");
                model.ListCategoryProductViewName = pfiles.Select(i => i.Replace(rootPath, "~/").Replace("\\", "/")).ToList();
            }
            else
            {
                model.ListCategoryProductViewName = new List <string>();
            }

            return(View(model));
        }