Http Post HELP
Hello. I'm very sorry for coming with such a request, but unfortunately I couldn't do the last part of a job given to me by my bosses because I was taking care of my grandfather. Although I know C#, I am not very experienced in .Net Core. My boss gave me this task, but even though I made it to the last one, I couldn't do the [HttpPost] part.
I wonder if you can help me?
A.
The .Net Core Console application will open.
A request will be sent to the endpoint below.
The returned response model will be deserialized and assigned to the relevant model.
A record will be saved to the txt file before the response is returned.
If there is the same record in txt, saving will not be done again.
B.
Request:-
Response:
[
{
"id": "1",
"name": "Google Pixel 6 Pro",
"data": {
"color": "Cloudy White",
"capacity": "128 GB"
}
},
{
"id": "2",
"name": "Apple iPhone 12 Mini, 256GB, Blue",
"data": null
},
{
"id": "3",
"name": "Apple iPhone 12 Pro Max",
"data": {
"color": "Cloudy White",
"capacity GB": 512
}
},
{
"id": "4",
"name": "Apple iPhone 11, 64GB",
"data": {
"price": 389.99,
"color": "Purple"
}
},
{
"id": "5",
"name": "Samsung Galaxy Z Fold2",
"data": {
"price": 689.99,
"color": "Brown"
}
},
{
"id": "6",
"name": "Apple AirPods",
"data": {
"generation": "3rd",
"price": 120
}
},
]
I wonder if you can help me?
A.
The .Net Core Console application will open.
A request will be sent to the endpoint below.
The returned response model will be deserialized and assigned to the relevant model.
A record will be saved to the txt file before the response is returned.
If there is the same record in txt, saving will not be done again.
B.
- An Endpoint will be developed and the record sent to txt will be returned according to the ID number given in the request.
- By developing an Endpoint, the Request information to be received in the form of the response model below will be added to the txt file as a new record. (IDs are unique and will increase sequentially.)
Request:-
Response:
[
{
"id": "1",
"name": "Google Pixel 6 Pro",
"data": {
"color": "Cloudy White",
"capacity": "128 GB"
}
},
{
"id": "2",
"name": "Apple iPhone 12 Mini, 256GB, Blue",
"data": null
},
{
"id": "3",
"name": "Apple iPhone 12 Pro Max",
"data": {
"color": "Cloudy White",
"capacity GB": 512
}
},
{
"id": "4",
"name": "Apple iPhone 11, 64GB",
"data": {
"price": 389.99,
"color": "Purple"
}
},
{
"id": "5",
"name": "Samsung Galaxy Z Fold2",
"data": {
"price": 689.99,
"color": "Brown"
}
},
{
"id": "6",
"name": "Apple AirPods",
"data": {
"generation": "3rd",
"price": 120
}
},
]