public static StackData GetFlairData(Guid associationId) { var stackAuthClient = new StackAuthClient(new UrlClient(), new JsonProtocol()); var associatedUsers = stackAuthClient.GetAssociatedUsers(associationId); associatedUsers = associatedUsers.OrderByDescending(au => au.Reputation).Where(au => au.Site.State != SiteState.Linked_Meta); int totalRep = associatedUsers.Sum(ai => ai.Reputation); string html = ""; AssociatedUser topUser = associatedUsers.First(); StackData data = new StackData() { DisplayHash = topUser.EmailHash, DisplayId = topUser.Id, DisplayName = topUser.DisplayName, DisplayUrl = topUser.Site.SiteUrl, Sites = (from u in associatedUsers select new StackSiteData() { SiteName = u.Site.Name, SiteState = u.Site.State, Reputation = u.Reputation, Url = u.Site.SiteUrl, UserId = u.Id, IsMod = u.Type == UserType.Moderator, Badges = Utility.GetBadgeCounts(u.Site, u.Id) }).ToList(), //TotalBadges = GetBadgeCounts(associatedUsers), }; return(data); }
public override string ToString() { return("[ID: " + ID + "]" + ", Rented book: " + RentedBook.Title + ", Rented by: " + AssociatedUser.GetUserName() + ", Start date: " + RentalStartDate); }
/* Called just before removing this rental from the list */ public void EndRental() { RentedBook.ReturnBook(); AssociatedUser.RemoveBook(); }
/* Called just after creating this rental */ private void StartRental() { RentedBook.BorrowBook(); AssociatedUser.AddBook(); }