General.Web/Controllers/Web/TestController.cs
(完整代码) 1KBusing System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using General.Core.Data;
using General.Entities;
using General.Entities.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
// For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace General.Mvc.Controllers.Web
{
public class TestController : Controller
{
private readonly GeneralDbContext dbcontext;
private readonly IRepository<tc_role> tcRoleRepository;
public TestController(GeneralDbContext dbcontext, IRepository<tc_role> tcRoleRepository)
{
this.dbcontext = dbcontext;
this.tcRoleRepository = tcRoleRepository;
}
// GET: /<controller>/
[HttpGet]
public IActionResult Index()
{
string conn = this.dbcontext.Database.GetDbConnection().ConnectionString;
//return Ok(conn);
return BadRequest("no auth");
}
[HttpGet]
public IActionResult Get()
{
var model = tcRoleRepository.GetAllAsync();
return Ok(model);
}
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
