private CharacterViewModel GenerateCharacter(Character arg, CharacterGroup group, IReadOnlyList <Character> siblings) { var vm = new CharacterViewModel { CharacterId = arg.CharacterId, CharacterName = arg.CharacterName, IsFirstCopy = !AlreadyOutputedChars.Contains(arg.CharacterId), IsAvailable = arg.IsAvailable, Description = arg.Description.ToHtmlString(), IsPublic = arg.IsPublic, IsActive = arg.IsActive, HidePlayer = arg.HidePlayerForCharacter && !arg.Project.IsPlotPublished(), ActiveClaimsCount = arg.Claims.Count(claim => claim.IsActive), Player = arg.ApprovedClaim?.Player, HasMasterAccess = HasMasterAccess, HasEditRolesAccess = HasEditRolesAccess, ProjectId = arg.ProjectId, FirstInGroup = siblings.First() == arg, LastInGroup = siblings.Last() == arg, ParentCharacterGroupId = group.CharacterGroupId, RootGroupId = Root.CharacterGroupId, IsHot = arg.IsHot && arg.IsAvailable, IsAcceptingClaims = arg.IsAcceptingClaims }; if (vm.IsFirstCopy) { AlreadyOutputedChars.Add(vm.CharacterId); } return(vm); }
private CharacterLinkViewModel GenerateCharacter(Character arg) { var vm = new CharacterLinkViewModel(arg) { IsFirstCopy = !AlreadyOutputedChars.Contains(arg.CharacterId), }; if (vm.IsFirstCopy) { AlreadyOutputedChars.Add(vm.CharacterId); } return(vm); }