public static Message CreateMessage(Database.POCO.Message messageEntity) { var msg = new Message(messageEntity, new User(messageEntity.Sender)); msg.Attachments = messageEntity.Attachments.Select(a => new Attachment(a, msg)).ToList(); messageEntity.MessagesReceivers.ForEach(mr => msg.AddReceiver(new User(mr.User), mr.IsRead)); messageEntity.MessagesCCs.ForEach(mcc => msg.AddCcUser(new User(mcc.User), mcc.IsRead)); messageEntity.MessagesBCCs.ForEach(mbcc => msg.AddBccUser(new User(mbcc.User), mbcc.IsRead)); return(msg); }
private static Message createMessage(Database.POCO.Message entity, User sender) { var msg = new Message(entity, sender); msg.Attachments = entity.Attachments.Select(a => new Attachment(a, msg)).ToList(); entity.MessagesReceivers.ForEach(mr => msg.AddReceiver(new User(mr.User), mr.IsRead)); entity.MessagesCCs.ForEach(mcc => msg.AddCcUser(new User(mcc.User), mcc.IsRead)); entity.MessagesBCCs.ForEach(mbcc => msg.AddBccUser(new User(mbcc.User), mbcc.IsRead)); return(msg); }