예제 #1
0
        public async Task <IActionResult> TermsOfUse(AcceptTermsViewModel model)
        {
            if (!accountService.IsSignedIn(User) || string.IsNullOrWhiteSpace(Site.RegistrationAgreement))
            {
                return(this.RedirectToSiteRoot(Site));
            }

            if (!ModelState.IsValid)
            {
                ViewData["Title"]      = sr["Registration Agreement Required"];
                model.TermsUpdatedDate = await timeZoneHelper.ConvertToLocalTime(Site.TermsUpdatedUtc);

                model.AgreementRequired     = true;
                model.RegistrationAgreement = Site.RegistrationAgreement;
                model.RegistrationPreamble  = Site.RegistrationPreamble;

                return(View(model));
            }

            var result = await accountService.AcceptRegistrationAgreement(User);

            //return Redirect("/");
            if (result)
            {
                return(this.RedirectToSiteRoot(Site));
            }

            return(View(model));
        }