示例#1
0
        public CustomFieldsViewModel(int?currentUserId, IClaimSource target)
        {
            CurrentUserId   = currentUserId;
            HasMasterAccess = target.HasMasterAccess(currentUserId);
            EditAllowed     = target.Project.Active;

            Target = target;

            HasPlayerClaimAccess = true;
            var renderer = new JoinrpgMarkdownLinkRenderer(Target.Project);

            Fields =
                target.Project.GetFields()
                .Select(ch => new FieldValueViewModel(this, ch, renderer))
                .ToList();
        }
示例#2
0
        /// <summary>
        /// Called from AddClaimViewModel
        /// </summary>
        public CustomFieldsViewModel(int?currentUserId, IClaimSource target)
        {
            CurrentUserId = currentUserId;

            AccessArguments = new AccessArguments(
                target.HasMasterAccess(currentUserId),
                playerAccessToCharacter: false,
                playerAccesToClaim: true);

            EditAllowed = target.Project.Active;

            Target = target;

            var renderer = new JoinrpgMarkdownLinkRenderer(Target.Project);

            Fields =
                target.Project.GetFieldsNotFilled()
                .Select(ch => new FieldValueViewModel(this, ch, renderer))
                .ToList();
        }
        /// <summary>
        /// Called from AddClaimViewModel
        /// </summary>
        public CustomFieldsViewModel(int?currentUserId, IClaimSource target) : this()
        {
            AccessArguments = new AccessArguments(
                target.HasMasterAccess(currentUserId),
                playerAccessToCharacter: false,
                playerAccesToClaim: true);

            EditAllowed = target.Project.Active;

            Target = target;

            var renderer = new JoinrpgMarkdownLinkRenderer(Target.Project);

            var fieldsList = target.Project.GetFieldsNotFilled();

            if (target is Character character)
            {
                fieldsList.FillIfEnabled(claim: null, character: character);
            }
            Fields =
                fieldsList
                .Select(ch => CreateFieldValueView(ch, renderer))
                .ToList();
        }