public ActionResult WriteMessage(Models.Message message)
        {
            //Validation
            if (TryValidateModel(message))
            {
                try
                {
                    //Create BLL instance
                    BLL.MessageService mesServ = new BLL.MessageService();

                    //Add message and return its hash link
                    string hashLink = mesServ.AddNewMessage(
                        message.Text,
                        message.TimesToShow,
                        DateTime.Now.AddMinutes(message.Minutes),
                        System.Web.Configuration.WebConfigurationManager.AppSettings["password"]);

                    //Debug LOCALHOST with port link
#if DEBUG
                    ViewBag.Link = Request.Url.Host + ":" + Request.Url.Port + "/" + hashLink;

                    //Release link version
#else
                    ViewBag.Link = Request.Url.Host + "/" + hashLink;
#endif
                    return(View());
                }
                catch (Exception ex)
                {
                    ViewBag.Error = ex.InnerException.InnerException.Message != null ?
                                    ex.InnerException.InnerException.Message
                        : "Ошибка";
                    return(View("ErrorPage"));
                }
            }
            else
            {
                return(View("Index", message));
            }
        }
        public ActionResult ReadMessage(string link)
        {
            //Create BLL instance
            BLL.MessageService mesServ = new BLL.MessageService();

            //Check for user agent
            if (mesServ.IsItMessengerUserAgent(Request.UserAgent))
            {
                return(View("Index"));
            }

            try
            {
                //Read message by hash link with password
                ViewBag.Message = mesServ.ReadMessage(link,
                                                      System.Web.Configuration.WebConfigurationManager.AppSettings["password"]);
                return(View("ReadMessage"));
            }

            catch
            {
                return(View("ErrorPAge"));
            }
        }
        private void StartRemoveTimer()
        {
            BLL.MessageService mesServ = new BLL.MessageService();

            mesServ.RemoverTimer();
        }