コード例 #1
0
        protected HeroModel GetHeroFromCookies(MajorType major)
        {
            var cookie = HttpContext.GetCookie(CookieType.Hero);
            var hero   = CoreLogic.DecodeHero(cookie, major);

            return(hero ?? (User.IsInRole(UserRole.Master.ToString()) ? null : CreateHero(major)));
        }
コード例 #2
0
        public async Task <FileResult> OnGet(MajorType major, bool getFromCookies = false)
        {
            var url = HttpContext.Request.GetDisplayUrl();

            RootPath = url.Remove(url.IndexOf("shared"));
            Converter.Orientation = PageOrientation.Landscape;
            if (getFromCookies)
            {
                var encoded = HttpContext.GetCookie(CookieType.Hero);
                Hero = _coreLogic.DecodeHero(encoded, major);
            }

            if (Hero == null)
            {
                getFromCookies = false;
                Hero           = _coreLogic.CreateHero(major);
            }

            var fileType = getFromCookies ? FileType.FilledHeroSheet : FileType.BaseHeroSheet;

            Hero.Skills = _skillService.GetHeroSkillGroup(Hero);
            return(await LoadPdf(Converter, SitePages.SharedMajorHeroSheet, fileType, this, getFromCookies));
        }