//GET: Get inbox
        public ActionResult Messages(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ApplicationUser applicationUser = db.Users.Find(id);

            if (applicationUser == null)
            {
                return(HttpNotFound());
            }
            InboxViewModel myModel = new InboxViewModel();

            myModel.User     = applicationUser;
            myModel.Messages = MessageDB.GetAllMessageForUserById(id);
            return(View(myModel));
        }
        public ActionResult Messages(InboxViewModel myModel)
        {
            PersonalMessage messageToSend = new PersonalMessage();

            //checks sender info and adds it too the message
            if (User.Identity.GetUserId() != null)
            {
                PersonalMessageHelper.ProcessSender(myModel, messageToSend, User.Identity.GetUserId());
            }

            //checks recipient info and adds it too the message
            if (myModel.RecipientName != null)
            {
                PersonalMessageHelper.ProcessRecipient(myModel, messageToSend);
            }
            ModelState.Clear();
            TryValidateModel(myModel);

            //checks if the model is valid, and finishes building the message
            //stores it in the DB to be grabbed
            //reloads the inbox
            if (ModelState.IsValid)
            {
                PersonalMessageHelper.ProcessBody(myModel, messageToSend);
                MessageDB.AddMessage(messageToSend);
                myModel.Messages = MessageDB.GetAllMessageForUserById(myModel.User.Id);
                return(RedirectToAction("Messages", "Person", new { id = myModel.User.Id }));
            }

            //checks if user is null and displays a error page
            if (myModel.User == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            //reloads the page
            return(View(myModel));
        }