public Chat(ClientChat cc, bool needRef) { ChatId = cc.ChatId; Subject = cc.Subject; if (cc.Messages != null && cc.Messages.Count != 0) { Messages = new List <Message>(); foreach (ClientMessage cm in cc.Messages) { Message m = new Message(cm); Messages.Add(m); } } if (needRef && cc.Users != null && cc.Users.Count != 0) { Users = new List <Participation>(); foreach (ClientUser cu in cc.Users) { Participation pa = new Participation { ChatId = cc.ChatId, Chat = this, UserId = cu.UserId, User = new User(cu, false) }; Users.Add(pa); } } }
public User(ClientUser cu, bool needRef) { UserId = cu.UserId; UserName = cu.UserName; Password = cu.Password; Gender = cu.Gender; City = cu.City; LC_Latitude = cu.LC_Latitude; LC_Longitude = cu.LC_Longitude; if (needRef && cu.Chats != null && cu.Chats.Count != 0) { Chats = new List <Participation>(); foreach (ClientChat cc in cu.Chats) { Participation pa = new Participation { ChatId = cc.ChatId, Chat = new Chat(cc, false), UserId = UserId, User = this }; } } }