Пример #1
0
        private ViewDataContainer BuildViewData()
        {
            ViewDataContainer ViewData = new ViewDataContainer();
            dynamic           ViewBag  = new ViewBagContainer(ViewData);

            ViewData.Set("Title", "An <html> View Test");
            ViewBag.Body = "<div>Test text is the best text.</div><div><a href=\"mailto:[email protected]\">Mail</a></div>";
            return(ViewData);
        }
Пример #2
0
        public ActionResult Index()
        {
            if (DKPHistory.history == null)
            {
                return(new ErrorResult("The server failed to initialize."));
            }

            ViewDataContainer viewData = new ViewDataContainer();

            viewData.Set("GuildName", DKPHistory.settings.guildName);

            IEnumerable <LootItem> items = DKPHistory.history.lootItems.Values
                                           .OrderByDescending(item => item.date)
                                           .ThenBy(item => item.name);

            viewData.Set("Loot", JsonConvert.SerializeObject(items));

            IEnumerable <Player> players = DKPHistory.history.playerClasses.Select(kvp => new Player()
            {
                name = kvp.Key, wowclass = kvp.Value
            });

            viewData.Set("Players", JsonConvert.SerializeObject(players));

            if (Debugger.IsAttached)
            {
                viewData.Set("VueScriptName", "vue.js");
            }
            else
            {
                viewData.Set("VueScriptName", "vue.min.js");
            }

            string rootDir = Globals.ApplicationDirectoryBase;

            if (Debugger.IsAttached)
            {
                rootDir += "../../";
            }

            return(new ViewResult(rootDir + "Index.html", viewData));
        }