【发布时间】:2019-01-15 11:05:13
【问题描述】:
一切正常,但经过身份验证处理后 _humans 列表没有改变。最后一个必须将令牌添加到列表数组中。
我的列表数组
public List<Human> _humans = new List<Human>
{
new Human ( 1,"test","false","asd" )
};
-- 非工作方法:
[HttpGet]
public async Task<IActionResult> register( Human employee)
{
....
await HttpContext.SignInAsync(principles);
humans.Add(new Human(22,"ASDDD","AAS",employee.token));
return RedirectToAction("Index","Home");
}
【问题讨论】:
-
你用的是EF,还是
_human只是一个本地的List? -
当我访问 index() 时,homecontroller 文件中的本地列表会向数组添加值,但使用 register() 时不会添加到列表中
-
它的基本公共列表组件没有 EF
-
在哪里检查列表是否发生了变化?
-
在另一个方法中。在 getvalues() 方法中,我尝试使用 jsonresult 获取值,但列表不受影响
标签: c# .net asp.net-mvc