Below is my endpoint
// D - Delete
[HttpPost,HttpDelete]
[ProducesResponseType(204)]
[ProducesResponseType(400)]
public async Task<IActionResult> Delete([FromBody](int eventId, int personId, DateTime purchaseDate) reqTO)
{
if (reqTO.eventId > 0 && reqTO.personId > 0 && reqTO.purchaseDate!= null)
{
var (flag, msg) = await _someRepository.Delete(reqTO.eventId, reqTO.personId, reqTO.purchaseDate);
if (flag)
{
//204
return CreateResponse<(int eventId, int personId, DateTime purchaseDate)>("Entry removed successfully", HttpStatusCode.NoContent, reqTO);
}
else
{
//TO DO
}
}
else
{
return BadRequest();
}
}
Now when I am calling this Endpoint from the postman with the below request payload
{
"eventId": 1,
"personId": 3,
"purchaseDate": "2019-01-04T18:25:43.511Z"
}
The Endpoint is hit, but the values assigned in the request payload are default values like eventId =0 ,personId =0 & purchaseDate = {01-01-0001 00:00:00}
.
NOTE: I don't want to create any DTO.
How do I map ReqPayload to Named Tuple??