public ChatObj(ChatObjectMsg message) { User1 = message.User1; User2 = message.User2; foreach (ChatMessage msg in message.Messages) { Messages.Add(new ChatObjMsg(msg.Time, msg.From, msg.To, msg.Message)); } }
public ChatObjectMsg ToNetworkModel() { ChatObjectMsg chat = new ChatObjectMsg(); chat.LatestUpdate = LatestUpdate; chat.User1 = User1; chat.User2 = User2; chat.Messages.AddRange(Messages.Select(x => x.ToNetworkModel())); return(chat); }