public ActionResult Messages(SN.Models.Messages model, string returnUrl)
 {
     if (ModelState.IsValid)
     {
         SN.Logics.Messages allMessages = new SN.Logics.Messages();
         allMessages.SearchAllMessages(WebSecurity.GetUserId(User.Identity.Name));
         ViewBag.Photo = allMessages.Photo;
         ViewBag.With  = allMessages.With;
         ViewBag.Count = allMessages.With.Count;
         ViewBag.Text  = allMessages.Text;
         ViewBag.Date  = allMessages.Date;
     }
     return(View());
 }
        public ActionResult MessagesHistory(SN.Models.Messages model, string username)
        {
            if (ModelState.IsValid)
            {
                SN.Logics.Messages messagesHistory = new SN.Logics.Messages();
                messagesHistory.SearchMessagesHistory(WebSecurity.GetUserId(username), WebSecurity.GetUserId(User.Identity.Name));
                using (UsersContext db = new UsersContext())
                {
                    ViewBag.With     = username;
                    ViewBag.Photo    = messagesHistory.Photo;
                    ViewBag.username = username;
                    ViewBag.From     = messagesHistory.With;

                    ViewBag.Text   = messagesHistory.Text;
                    ViewBag.Date   = messagesHistory.Date;
                    ViewBag.IsRead = messagesHistory.IsRead;
                    ViewBag.Count  = messagesHistory.With.Count();
                }
            }
            return(View());
        }