src/ZKEACMS.Message/Controllers/MessageHandleController.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/* http://www.zkea.net/ 
 * Copyright (c) ZKEASOFT. All rights reserved. 
 * http://www.zkea.net/licenses */

using Easy;
using Easy.Constant;
using Easy.Extend;
using Easy.Mvc.Extend;
using Easy.Mvc.ValueProvider;
using Easy.Mvc.ViewResult;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Net;
using ZKEACMS.Filter;
using ZKEACMS.Message.Models;
using ZKEACMS.Message.Service;
using ZKEACMS.Setting;

namespace ZKEACMS.Message.Controllers
{
    public class MessageHandleController : Controller
    {
        private readonly IMessageService _messageService;
        private readonly ICommentsService _commentService;
        private readonly IApplicationContextAccessor _applicationContextAccessor;
        private readonly IApplicationSettingService _applicationSettingService;
        private readonly ILocalize _localize;
        public MessageHandleController(IApplicationContextAccessor applicationContextAccessor,
            IMessageService messageService,
            ICommentsService commentsService,
            ILocalize localize,
            IApplicationSettingService applicationSettingService)
        {
            _applicationContextAccessor = applicationContextAccessor;
            _messageService = messageService;
            _commentService = commentsService;
            _localize = localize;
            _applicationSettingService = applicationSettingService;
        }
        [HttpPost, ValidateAntiForgeryToken, RenderRefererPage]
        public IActionResult PostMessage(MessageEntity entity)
        {
            if (ModelState.IsValid)
            {
                entity.Status = GetDefaultStatus();
                var result = _messageService.Add(entity);
                ModelState.Merge(result);
                if (!result.HasViolation)
                {
                    TempData["Message"] = _localize.Get("Thank You for your submit!");
                }
            }
            return View(entity);
        }
        [HttpPost, ValidateAntiForgeryToken]
        public IActionResult PostComment(string CommentContent, string PagePath, string ReplyTo, string Title)
        {
            string referer = Request.GetReferer();
            if (referer.IsNullOrEmpty())
            {
后面还有 35 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。