This action will force synchronization from uncle wang/OAuthApp, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
using System.Linq;using Microsoft.AspNetCore.Mvc;using OAuthApp.Data;using Swashbuckle.AspNetCore.Annotations;using OAuthApp.Filters;using OAuthApp.Services;namespace OAuthApp.Apis{[SwaggerTag("API CodeGen")][ServiceFilter(typeof(ApiRequestLoggingAttribute))]public class ApiCodeGeneratorsController : BaseController{private readonly ApiDbContext _context;public ApiCodeGeneratorsController(ApiDbContext context){_context = context;}[HttpGet][SwaggerOperation(OperationId = "ApiCodeGens")][EncryptResultFilter]public IActionResult List(long apiId, int skip, int take){var q = _context.ApiCodeGenerators.Where(x => x.ApiID == apiId).AsQueryable();var total = q.Count();var data = q.Skip(skip).Take(take).OrderByDescending(x => x.ID).ToList();return OK(new{total,data});}[HttpGet("{id}")][SwaggerOperation(OperationId = "ApiCodeGen")][EncryptResultFilter]public IActionResult Get(long id){var result = _context.ApiCodeGenerators.FirstOrDefault(x => x.ID == id);if (result == null){return NotFound();}return OK(result);}[HttpPost][SwaggerOperation(OperationId = "ApiCodeGenPost")]public IActionResult Post(ApiCodeGenerator apiCodeGenerator){if(_context.ApiCodeGenerators.Any(x=>x.ApiID==apiCodeGenerator.ApiID&&x.CodeGeneratorID==apiCodeGenerator.CodeGeneratorID)){return Error("请勿重复添加");}_context.ApiCodeGenerators.Add(apiCodeGenerator);_context.SaveChanges();return OK(new { id = apiCodeGenerator.ID });}[HttpDelete("{id}")][SwaggerOperation(OperationId = "ApiCodeGenDelete")]public IActionResult Delete(long id){var result = _context.ApiCodeGenerators.FirstOrDefault(x => x.ID == id);if (result == null){return NotFound();}_context.ApiCodeGenerators.Remove(result);_context.SaveChanges();return OK(true);}}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。