Should I implement business logic on a Model or a ViewModel

后端 未结 4 749
走了就别回头了
走了就别回头了 2021-01-04 11:28

When I\'m processing business logic in an MVVM app. Should I do this on the Model or the ViewModel?

For example, if I want to re-calculate costs after an Asset has b

4条回答
  •  心在旅途
    2021-01-04 12:03

    if you model contain required data for calculation you can use model.if model does not contain the data means create view-model and get data to do the calculation.(With respect to Business logic )

    if you want to pass this data to view create View Model It improves code re-use opportunities

提交回复
热议问题