testing ASP.NET Web API HTTP Post using posting

Viewed 22

How do you pass data and credentials to ASP.NET Core Web API while testing using postman?

Here is my code

[HttpPost]
public IActionResult Create([FromBody] Product item)
{
    if (item == null)
    {
        return BadRequest();
    }

    _context.Product.Add(item);
    _context.SaveChanges();

    return CreatedAtRoute("GetById", new { id = item.Id }, item);
}
0 Answers
Related