コード例 #1
0
        public IActionResult RerollResult(UserPageModel secretMatch)
        {
            //verify access
            if (!verifySessionCookie())
            {
                return(View("InvalidCredentials"));
            }
            bool.TryParse(_dataAccessor.GetSettingValue("AllowMatching"), out bool allowMatch);
            secretMatch.AllowMatching = allowMatch;
            if (string.IsNullOrEmpty(secretMatch?.Name) || !secretMatch.AllowMatching)
            {
                //How? Why? Just start over
                return(RedirectToAction("SignIn"));
            }

            if (!string.IsNullOrEmpty(secretMatch.TheirSecretMatch))
            {
                _dataAccessor.RemoveMatch(secretMatch.Name, secretMatch.TheirSecretMatch);
                _dataAccessor.CreateRestriction(secretMatch.Name, secretMatch.TheirSecretMatch, false, false);
            }

            UserPageModel match = new UserPageModel()
            {
                Name        = secretMatch.Name,
                AllowReroll = false
            };

            return(RedirectToAction("CreateMatch", match));
        }