【发布时间】:2019-09-05 10:50:49
【问题描述】:
我有一个Controller的动作方法Create如下:
[HttpPost]
public async Task<IActionResult> Create([Required]string name)
{
if (ModelState.IsValid)
{
IdentityResult result = await roleManager.CreateAsync(new IdentityRole(name));
if (result.Succeeded)
return RedirectToAction("Index");
else
Errors(result);
}
return View(name);
}
[Required] 属性在参数中的作用是什么?
【问题讨论】:
标签: c# asp.net asp.net-mvc asp.net-core-mvc data-annotations