0

I am fairly new to ASP.NET Core MVC and have created a Web API by following this tutorial.

Everything works fine but the data for the CRUD operations is stored in memory, and I am being asked to have the data stored in a json file instead.

Can anybody give me some advice on how to do it, or point me to a quick tutorial that explains how to modify the context/repository to do this? I am used to Entity Framework/SQL server transactions and I know this is a lot simpler, but I have never done it before and need some guidance. :) I have found some related questions but they seem much more complicated than what I am trying to do.

My code matches exactly what is in the URL but I will be happy to post parts of it if it is helpful. Thank you so much!

Irina
  • 1,333
  • 3
  • 17
  • 37
  • Check this out. http://www.c-sharpcorner.com/UploadFile/858292/create-a-json-file-with-C-Sharp/ or http://stackoverflow.com/questions/36786411/c-sharp-save-object-to-json-file or http://stackoverflow.com/questions/33297574/easy-way-to-write-data-to-local-json-file – Alf Moh Feb 28 '17 at 16:29
  • Are you sure that you want to add JSON objects in file - like plain text file? If you have file you would need to load entire file just to add/remove single object and then save it again. It just looks very strange requirement. – Jovan MSFT Mar 02 '17 at 19:52
  • Maybe of-topic, but if you want example with SQL database you can find it here https://www.codeproject.com/Articles/1106622/Building-REST-services-with-ASP-NET-Core-Web-API-a – Jovan MSFT Mar 02 '17 at 19:54
  • Thank you, Jovan. Yes, this is quick test project to familiarize myself with Bluemix and I was asked to store the data in a plain text file using json. – Irina Mar 03 '17 at 20:30

0 Answers0