【发布时间】:2022-01-20 08:03:16
【问题描述】:
我是 stackoverflow 的新手。我想知道如何添加和编辑产品
例如
[HttpPost("api/products")]
public ActionResult <IEnumerable<Product>> CreateProducts(IEnumerable<Product> products)
{
// Note: I am getting product as collection
// I am using ef core. and would like to add all products
}
[HttpPut("api/products")]
public ActionResult <IEnumerable<Product>> updateProducts(IEnumerable<Product> products)
{
// Note: I am getting product as collection
// I am using ef core. and would like to edit all products
}
class Product
{
public int Id {get;set;}
public string Name {get;set;}
public string Price {get;set;}
}
任何建议。我已经完成了谷歌,发现了许多将产品添加或编辑为单个对象而不是集合的示例
问候
【问题讨论】:
-
请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。
标签: asp.net asp.net-core webapi