Could anyone tell me which component in MVC pattern is responsible for writing files to disk? Is this a controller or model? Some links or examples would be appreciated(especially for ASP.NET MVC, but not necessarily 🙂
Greetings
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Hi=)
Model must be responsible for persistence.
If you use database -> try with Repository pattern.
If you need to save files on disk directly -> just create something like “MyFileSavingService” end encapsulate whole logic of saving file to disk in it.
And then, from your controller just call
MyFileDavingService.SaveSomthingToSomewhere(bla,blabla);