Hi I am working with mvc4 now. can any body tell me how to save the data using json?
mostly all curd operation using json?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
R JPosted Aug 21, 2014, 5:14 PM
lv prasadPosted Aug 21, 2014, 10:30 AM
Thank you very much for you reply. i have no special requirement. just i am practising my self ,previously i worked on net 3.5 where we used to design our page with asp controls and methods will be written in button click...i need to do the project in mvc now.
Any way the url which you have given me help full. i have tried using ajax the data been save.Thanks for your help. i will be in touch with you regarding this mvc tutorial please do the need full..
R JPosted Aug 19, 2014, 10:26 PM
First of all I really do not understand why do you want to explicitly transfer the data specifically in the form of Json. If you use Ajax call($.post on save click in your example), the data is being serialized and sent to the destination where MVC4/Jquery takes care about serialization. Could you explain what is your specific scenario?
You can do this simply, if you use MVC4 as below. Still you can use JQUERY calls on post.
http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/implementing-basic-crud-functionality-with-the-entity-framework-in-asp-net-mvc-application
Or go through this in specific case.
http://www.c-sharpcorner.com/Blogs/14611/
let me know if you need any help, thanks.
lv prasadPosted Aug 19, 2014, 6:44 PM
I want to read the data from view using json and pass that data to controller from i want to store it to DB.
EX:
Name --------
Address ---------
SAve.
When user enter the data in name,address in a view and he click the button save.Then the data should be posted to controller using json and saved to db.(let say i am writing the save method directly in controller not model)
R JPosted Aug 19, 2014, 6:26 PM
Where do you want to save? Do you want to convert the retrieved Json to Model and then update to DB?