public ClaimViewModel(int currentUserId, Claim claim, IEnumerable <PluginOperationData <IPrintCardPluginOperation> > pluginOperationDatas, IReadOnlyCollection <PlotElement> plotElements) { ClaimId = claim.ClaimId; Comments = claim.Comments.Where(comment => comment.ParentCommentId == null) .Select(comment => new CommentViewModel(comment, currentUserId)).OrderBy(c => c.CreatedTime); HasMasterAccess = claim.HasMasterAccess(currentUserId); CanManageThisClaim = claim.CanManageClaim(currentUserId); IsMyClaim = claim.PlayerUserId == currentUserId; Player = claim.Player; ProjectId = claim.ProjectId; Status = claim.ClaimStatus; CharacterGroupId = claim.CharacterGroupId; GroupName = claim.Group?.CharacterGroupName; CharacterId = claim.CharacterId; CharacterActive = claim.Character?.IsActive; OtherClaimsForThisCharacterCount = claim.IsApproved ? 0 : claim.OtherClaimsForThisCharacter().Count(); HasOtherApprovedClaim = !claim.IsApproved && claim.OtherClaimsForThisCharacter().Any(c => c.IsApproved); Data = new CharacterTreeBuilder(claim.Project.RootGroup, currentUserId).Generate(); OtherClaimsFromThisPlayerCount = OtherClaimsFromThisPlayerCount = claim.IsApproved || (claim.Project.Details?.EnableManyCharacters ?? false) ? 0 : claim.OtherPendingClaimsForThisPlayer().Count(); Description = claim.Character?.Description.ToHtmlString(); Masters = claim.Project.GetMasterListViewModel() .Union(new MasterListItemViewModel() { Id = "-1", Name = "Нет" }); ResponsibleMasterId = claim.ResponsibleMasterUserId ?? -1; ResponsibleMaster = claim.ResponsibleMasterUser; Fields = new CustomFieldsViewModel(currentUserId, claim); Navigation = CharacterNavigationViewModel.FromClaim(claim, currentUserId, CharacterNavigationPage.Claim); ClaimFee = new ClaimFeeViewModel(claim, currentUserId); Problems = claim.GetProblems().Select(p => new ProblemViewModel(p)).ToList(); PlayerDetails = UserProfileDetailsViewModel.FromUser(claim.Player); PrintPlugins = pluginOperationDatas.Select(PluginOperationDescriptionViewModel.Create); ProjectActive = claim.Project.Active; if (claim.PlayerUserId == currentUserId || claim.HasMasterAccess(currentUserId, acl => acl.CanManageMoney)) { //Finance admins can create any payment. User also can create any payment, but it will be moderated PaymentTypes = claim.Project.ActivePaymentTypes; } else { //All other master can create only payment from user to himself. PaymentTypes = claim.Project.ActivePaymentTypes.Where(pt => pt.UserId == currentUserId); } if (claim.Character != null) { ParentGroups = new CharacterParentGroupsViewModel(claim.Character, claim.HasMasterAccess(currentUserId)); } Plot = claim.IsApproved && claim.Character != null ? claim.Character.GetOrderedPlots(plotElements).ToViewModels(currentUserId, claim.Character) : Enumerable.Empty <PlotElementViewModel>(); }