【发布时间】:2022-01-06 15:49:42
【问题描述】:
我有一个 .Net Core + Entity Framework 应用程序,它允许用户查看引擎生产列表并编辑某些内容。
如果没有错误,一切看起来都很好。
但是当我遇到错误时,它会使用丑陋的视图而不是我的正常视图。
这是一个控制器示例,在没有错误时看起来很棒,但如果有错误,它只是白色背景上的黑色文本。
有没有办法让它适合我的网络应用程序的其余部分?
谢谢!
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(int id, [Bind("Id,EngineName,FactoryName")] ProductionRound productionRound)
{
if (ModelState.IsValid)
{
try
{
_context.Update(productionRound);
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!ProductionRoundExists(productionRound.Id))
{
return NotFound();
}
else
{
throw;
}
}
return RedirectToAction(nameof(Index));
}
return View(productionRound);
}
【问题讨论】:
标签: asp.net-core entity-framework-core