private PackageOwnerInfo GetPackageOwnerInfo(int ownerId, bool openForCollab, int contentId) { var owner = MembershipHelper.GetById(ownerId); var ownerInfo = new PackageOwnerInfo { Karma = owner.Karma(), Owner = owner.Name, OwnerAvatar = Utils.GetMemberAvatar(owner, 200, true) }; if (openForCollab) { var service = new ContributionService(DatabaseContext); var contributors = service.GetContributors(contentId).ToList(); if (contributors != null && contributors.Any()) { var names = new List <string>(); foreach (var contributor in contributors) { var member = MembershipHelper.GetById(contributor.MemberId); if (member != null) { names.Add(member.Name); } } ownerInfo.Contributors = names.ToArray(); } } return(ownerInfo); }
private PackageOwnerInfo GetPackageOwnerInfo(int ownerId, bool openForCollab, int contentId) { var owner = MembershipHelper.GetById(ownerId); var avatarService = new AvatarService(); var avatarPath = avatarService.GetMemberAvatar(owner); var avatar = $"{avatarPath}?width=200&height=200&mode=crop&upscale=true"; var ownerInfo = new PackageOwnerInfo { Karma = owner?.Karma() ?? 0, Owner = owner?.Name ?? "", OwnerAvatar = avatar }; if (openForCollab) { var service = new ContributionService(DatabaseContext); var contributors = service.GetContributors(contentId).ToList(); if (contributors != null && contributors.Any()) { var names = new List <string>(); foreach (var contributor in contributors) { var member = MembershipHelper.GetById(contributor.MemberId); if (member != null) { names.Add(member.Name); } } ownerInfo.Contributors = names.ToArray(); } } return(ownerInfo); }