public FriendsAppUser(FriendsAppUserMsg msg) { UserId = msg.UserId; Username = msg.Username; CurrentRoomId = msg.InRoomCase == FriendsAppUserMsg.InRoomOneofCase.RoomId ? (uint?)msg.RoomId : null; FriendsList = msg.FriendList.ToArray(); }
public FriendsAppUserMsg ToNetworkModel() { FriendsAppUserMsg friendMsg = new FriendsAppUserMsg(); friendMsg.UserId = UserId; friendMsg.Username = Username; if (CurrentRoomId.HasValue) { friendMsg.RoomId = CurrentRoomId.Value; } if (FriendsList != null) { friendMsg.FriendList.AddRange(FriendsList); } return(friendMsg); }