You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using AuthStudy.WebApp.VModels;
|
|
|
|
|
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
|
|
namespace AuthStudy.WebApp.Controllers
|
|
|
|
|
{
|
|
|
|
|
[Route("api/[controller]/[action]")]
|
|
|
|
|
[ApiController]
|
|
|
|
|
public class AccountsController : ControllerBase
|
|
|
|
|
{
|
|
|
|
|
public AccountsController() { }
|
|
|
|
|
|
|
|
|
|
[Authorize]
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public IActionResult GetAll()
|
|
|
|
|
{
|
|
|
|
|
List<AccountVM> accounts = new List<AccountVM>()
|
|
|
|
|
{
|
|
|
|
|
new AccountVM(){ Name="张三", Email="zhangsan@qq.com", Password="123456"},
|
|
|
|
|
new AccountVM(){ Name="小明", Email="xiaoming@qq.com", Password="123456"},
|
|
|
|
|
new AccountVM(){ Name="癫子", Email="dianzi@qq.com", Password="123456"}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return new JsonResult(accounts);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public IActionResult Login(string loginName, string loginPassword)
|
|
|
|
|
{
|
|
|
|
|
var info = new { Name = "", Roles = "Admin" };
|
|
|
|
|
|
|
|
|
|
return new JsonResult(info);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|