I want to use the ViewModel-Pattern in connection with my MVC setup. I believe to have understood the idea, but I don't know how to behave in the following situtation:
My Model manages data, which I display in my view, but I also want to send the data via mail and add to Jira etc. In other words I also want to provide the data to an external program.
Before I had a ViewModel, I have set and gotten my data in the Controller, where I also have sent it via mail (and jira).
I believe the sending part does not belong in the ViewModel, therefore now I had to construct complicated methods in the ViewModel to provide the data for the mail.
Does anybode know the correct behaviour here? Also I would be happy if somebody has a good resource about this topic.
Thank you!
Edit:
I have a functionality like this:
sendMail(data1, data2, data3);
createJiraComment(data4, data5, dat6);
data1
to data6
hereby refer to data of my underlying database, which I "contact" via my ViewModel.
question from:
https://stackoverflow.com/questions/65937545/mvc-and-viewmodels 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…