示例#1
0
        public void SendCommentInfo(CommentViewModel model)
        {
            var template = GetTemplate("CommentInfo.aspx");
            var text = template.Apply(model);

            SendNotification(string.Empty, AdminEmail, "Добавлен отзыв на сайт", text);
        }
示例#2
0
        public ActionResult Index(Comment comment)
        {
            comment.AuthorId = HttpContext.UserPrincipal().id;
            long commentId = meridian.commentsStore.AddComment(comment);

            if (commentId > 0)
            {
                var model = new CommentViewModel();

                switch (comment.ProtoName.ToLower())
                {
                    case "hotels":
                        model.EntityName = meridian.hotelsStore.Get(comment.id).title;
                        model.EntityType = "отеля";
                        break;
                    case "resorts":
                        model.EntityName = meridian.resortsStore.Get(comment.id).title;
                        model.EntityType = "курорта";
                        break;
                }

                model.Comment = comment.CommentText;

                model.EntityUrl = Request.Url.ToString();
                model.EntityAdminUrl = string.Format("{0}://{1}/admin/admin_comments/Single/{2}",
                    Request.Url.Scheme, Request.Url.Authority, commentId);

                CreateMailer().SendCommentInfo(model);
            }

            return Redirect(Request.Url.AbsolutePath);
        }