Coming from the JS/TS world I'm new to .NET, but I must say I've always found this JsonPatch to be unnecessarily complex. First you have to create new DTO, then apply the patch, then use the applied patch to update the existing records. That's too much complexity for a simple update.
Sir, I've one question I'm using the store procedure in my application so How I can implement the patch Web API. Do you have any video on that ? Please guide... Thanks in advance sir
Stored procedure is completely backend logic, there is nothing to do with web api patch. If you want partial data from end user the use patch else post or put. The backend db call or sp call is same.
Is there any way to avoid [op, path, value] statements? If I send just the path and value in a key value pair, like "studentName":"Anil New" and it should automatically replace the value of "studentName" only and keep rest all as it were.
in this case under HttpPatch the validation for individual propery is not working even if StudentDTO is used. For example i can replace email address for any string. Could you show the solution to keep the same validation as we have in other http request ?
Thank you for asking.. We are already handling the validations with the below modelstate code in the video patchDocument.ApplyTo(studentDTO, ModelState); if (!ModelState.IsValid) return BadRequest(ModelState);
Git Repo used in this tutorial : github.com/Nehanthworld/Asp.Net-Core-Web-API-Tutorial
Thanks
thanks so much, it's worked for me
Awesome sir
Nice explanation
Thanks for this great tutorial
Perfect tutorial bro
Thanks
Ty so much!!
Thanks for this tuto
Coming from the JS/TS world I'm new to .NET, but I must say I've always found this JsonPatch to be unnecessarily complex. First you have to create new DTO, then apply the patch, then use the applied patch to update the existing records. That's too much complexity for a simple update.
True, I never used it. 😊
Sir, I've one question
I'm using the store procedure in my application so How I can implement the patch Web API.
Do you have any video on that ? Please guide... Thanks in advance sir
Stored procedure is completely backend logic, there is nothing to do with web api patch. If you want partial data from end user the use patch else post or put. The backend db call or sp call is same.
why we can't apply patchDocument.ApplyTO(existing student ) directly?
Necause we are using notracking, if we are not using notracking we can try that
How such request would be constructed through mvc or blazor form when user clicks the button?
Ajax call
Is there any way to avoid [op, path, value] statements?
If I send just the path and value in a key value pair, like "studentName":"Anil New" and it should automatically replace the value of "studentName" only and keep rest all as it were.
Not sure bro
in this case under HttpPatch the validation for individual propery is not working even if StudentDTO is used. For example i can replace email address for any string. Could you show the solution to keep the same validation as we have in other http request ?
Thank you for asking..
We are already handling the validations with the below modelstate code in the video
patchDocument.ApplyTo(studentDTO, ModelState);
if (!ModelState.IsValid)
return BadRequest(ModelState);