public async Task <ActionResult> Details(string id)
 {
     ExchangeClientDemo.Models.MyMessage myMessage = null;
     try {
         MyMessagesRespository repo = new MyMessagesRespository();
         myMessage = await repo.GetMessage(id);
     }
     catch (RedirectRequiredException x) {
         return(Redirect(x.RedirectUri.ToString()));
     }
     return(View(myMessage));
 }
        public async Task <ActionResult> Send(ExchangeClientDemo.Models.MyMessage myMessage)
        {
            if (Request.HttpMethod == "POST")
            {
                MyMessagesRespository repo = new MyMessagesRespository();
                await repo.SendMessage(myMessage);

                return(Redirect("/Mail"));
            }
            else
            {
                string currentUserEmail = System.Web.HttpContext.Current.Session["currentUserEmail"].ToString();
                myMessage.From         = currentUserEmail;
                myMessage.ToRecipients = new List <string>()
                {
                    currentUserEmail
                };
                return(View(myMessage));
            }
        }