Student.Core.API/Controllers/AccountController.cs

(开头部分) 3KB

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

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.Extensions.Logging;
using Student.Core.API.Code.Attributes;
using Student.DTO;
using Student.IServices;
using yrjw.ORM.Chimp.Result;

namespace Student.Core.API.Controllers
{
    [Description("账户信息")]
    public class AccountController : ControllerAbstract
    {
        private readonly Lazy<IAccountService> AccountService;
        public AccountController(ILogger<ControllerAbstract> logger, Lazy<IAccountService> accountService) : base(logger)
        {
            AccountService = accountService;
        }

        [Description("通过指定账户ID,返回该账户信息")]
        [OperationId("获取账户信息")]
        [Parameters(name="id", param = "账户ID")]
        [ResponseCache(Duration = 0)]
        [HttpGet("{id}")]
        public async Task<IResultModel> Query([BindRequired]Guid id)
        {
            _logger.LogDebug($"操作:根据ID获取指定账户{id}");
            return await AccountService.Value.GetByIdAsync(id);
        }

        [Description("获取全部账户列表")]
        [ResponseCache(Duration = 0)]
        [HttpGet]
        public async Task<IResultModel> GetListAll()
        {
            _logger.LogDebug("操作:获取全部账户列表");
            return await AccountService.Value.GetListAllAsync(true);
        }

        [Description("添加账户,成功后返回当前账户信息")]
        [OperationId("添加账户")]
        [HttpPost]
        public async Task<IResultModel> Add([FromBody]AccountDTO model)
        {
            _logger.LogDebug($"操作:添加账户{model.UserName}");
            return await AccountService.Value.InsertAsync(model);
        }

        [Description("修改账户,成功后返回当前账户信息")]
        [OperationId("修改账户")]
        [HttpPut]
        public async Task<IResultModel> Update([FromBody]AccountDTO model)
        {
            _logger.LogDebug($"操作:修改账户{model.Id.ToString()}");
后面还有 23 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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