【发布时间】:2020-04-25 11:41:28
【问题描述】:
我有下表:
我想用RequestId=2 更新行的ApproveStatus,其中goodsId = 4 被拒绝而goodsId=1 被批准。
我的问题是如何在 ASP.NET Core 2.2 中使用 Entity Framework Core。
这是我到目前为止所做的:
// model contain "approve" and "reject" strings and requestId which came from view
public IActionResult ApproveList(List<ApprovedGoodsByAdminAssistVM> model)
{
// I got the requestId from model
var id = model.Select(s => s.RequestId).FirstOrDefault();
// Filtered the two record with RequestId=2 from the table
var goodsList = context.RequestGoodsBrand
.Where(x => x.RequestId == id).ToList();
}
接下来要做什么?
提前致谢
【问题讨论】:
-
“其中货物Id=4 被拒绝而货物Id=1 被批准”是什么意思?对于同一属性/列,单行不能有两个不同的值。在您的表中,有两行单独的行,一行 GoodsID=4,一行 GoodsID=1。你想对每个人做什么?另外,你的
ApprovedGoodsByAdminAssistVM是什么?
标签: c# asp.net-core entity-framework-core