public static TModel FromProfile <TModel>(Profile profile) where TModel : ProfileApiModel, new() { var model = new TModel(); model.Id = profile.Id; model.User = UserApiModel.FromUser(profile.User); model.Conversations = profile.Conversations.Select(x => ConversationApiModel.FromConversation(x)).ToList(); return(model); }
public static TModel FromMessage <TModel>(Message message) where TModel : MessageApiModel, new() { var model = new TModel(); model.Id = message.Id; model.FromId = message.FromId; model.ToId = message.ToId; model.Body = message.Body; model.ConversationId = message.ConversationId; model.Conversation = ConversationApiModel.FromConversation(message.Conversation); return(model); }