StudentManageSystem/Controllers/StudentInfoController.cs

(开头部分) 6KB

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

using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.Extensions.Logging;
using Student.DTO;
using StudentManageSystem.HttpApis;
using StudentManageSystem.ViewModels;
using WebApiClient.Parameterables;
using yrjw.ORM.Chimp.Result;

namespace StudentManageSystem.Controllers
{
    public class StudentInfoController : Controller
    {
        private readonly ILogger<StudentInfoController> _logger;
        public readonly IStudentInfoApi _studentInfoApi;
        public readonly IDepartApi _separtApi;

        public StudentInfoController(ILogger<StudentInfoController> logger, IStudentInfoApi studentInfoApi, IDepartApi departApi)
        {
            _logger = logger;
            _studentInfoApi = studentInfoApi;
            _separtApi = departApi;
        }

        //学生信息列表展示页面
        [HttpGet]
        [Authorize]
        public IActionResult Index()
        {
            return View();
        }

        //添加页面
        [HttpGet]
        [Authorize]
        public async Task<IActionResult> CreateAsync()
        {
            await GetDepartList();
            return View();
        }

        //修改页面
        [HttpGet]
        [Authorize]
        public async Task<IActionResult> EditAsync(long? id)
        {
            var result = await _studentInfoApi.QueryAsync(id.Value);
            if (result.Success == false)
            {
                return View();  //建议跳转到指定错误页面
            }
            await GetDepartList();
            return View(result.Data);
        }

        //获取部门下拉选择列表数据
后面还有 125 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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