Forum Discussion
Csharplearning2021
Dec 17, 2021Copper Contributor
web api Http post and put as collection
Hi,
I am learning .net. I would like to know how can I add and Edit products using webapi, ef core.
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{
int Id;
string Name
String Price
}
any advice. I have done google and found many example that add or edit product as single object but not as collection
Regards
1 Reply
- dgtvanCopper ContributorYou should try with some search results here https://www.google.com/search?q=asp+.net++post+array+objects
Get back here and share what you have done.