Hi Guys,

I am referencing a project so I can create a messaging system on my website.
http://www.packtpub.com/article/aspd...ssaging-system

Can someone please advise me as to how I would replicate this function in my dal and bll so that I can get the same output. In the example they use a datacontext. I mostly return datatables in frim my DAL.

Code:
public List<MessageWithRecipient> GetMessagesByAccountID(Int32 AccountID, Int32 PageNumber, MessageFolders Folder)
        {
            List<MessageWithRecipient> result = new List<MessageWithRecipient>();
            using(FisharooDataContext dc = conn.GetContext())
            {
                IEnumerable<MessageWithRecipient> messages = (from r in dc.MessageRecipients 
                                                              join m in dc.Messages on r.MessageID equals m.MessageID 
                                                              join a in dc.Accounts on m.SentByAccountID equals a.AccountID
                                                 where r.AccountID == AccountID && r.MessageFolderID == (int)Folder
                                                 orderby m.CreateDate descending
                                                 select new MessageWithRecipient()
                                                            {
                                                                Sender = a,
                                                                Message = m,
                                                                MessageRecipient = r
                                                            }).Skip((PageNumber - 1)*10).Take(10);
                result = messages.ToList();
            }
            return result;
        }
here is an example of how I return data most times:

Code:
Public Function GetMessageRecipientsByMessageID(ByVal MessageID As Integer) As DataTable
            Using con As New MySqlConnection(strCon)

                Dim cmd As MySqlCommand = New MySqlCommand("SELECT * FROM messagerecipients WHERE (MessageID = ?MessageID);", con)

                cmd.Parameters.AddWithValue("?MessageID", MessageID)

                con.Open()

                Dim reader As MySqlDataReader = cmd.ExecuteReader

                _data.Load(reader)

                con.Close()
                reader.Close()
                cmd.Dispose()

                Return _data
            End Using
        End Function
Please help me as this is a bit out of my league.