StudentManageSystem/Controllers/HomeController.cs

(开头部分) 1KB

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

using System.Diagnostics;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using StudentManageSystem.HttpApis;
using StudentManageSystem.ViewModels;

namespace StudentManageSystem.Controllers
{
    public class HomeController : Controller
    {
        private readonly ILogger<HomeController> _logger;
        public readonly IAuthApi _authApi;

        public HomeController(ILogger<HomeController> logger, IAuthApi authApi)
        {
            _logger = logger;
            _authApi = authApi;
        }

        public IActionResult Index()
        {
            return View();
        }

        [Authorize]
        public async Task<IActionResult> MainPC()
        {
            var _info = await _authApi.AuthInfo();
            if (_info.Success)
            {
                ViewBag.Name = _info.Data.Account.Name;
                if(_info.Data.AuthInfo.Platform == Student.Model.Enums.EnumPlatform.Web)
                {
                    return View();
                }
            }
            return View();
        }

        /// <summary>
        /// 弹窗子窗口,保存后刷新父级页面数据表格
        /// </summary>
        /// <param name="msg">弹窗提示信息</param>
        /// <param name="json">不为空时,只刷新本地数据</param>
        /// <returns></returns>
        public IActionResult ShowMsg(string msg = "保存成功!", string json = "")
        {
            ViewBag.Msg = msg;
            ViewBag.Data = json;
            return View();
        }

        [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
        public IActionResult Error()
        {
            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
        }
    }
后面还有 1 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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