Answer the question
In order to leave comments, you need to log in
How to implement from an architectural point of view the display of the cost with or without a discount in the model?
Tell me how to implement correctly from an architectural point of view the display of the cost of goods with or without a discount. There is a model in which two values are stored. The user can activate the promo code and then we need to display the cost on the page depending on it. So, now I did the following. In the template, I check if a discount has been applied, and if so, then I display the discounted value, if not, then something else. But I don't like the solution. Somehow it looks awful. Maybe you need to make a method for the model, to which to pass the parameter whether there was a discount or not, and then already in this method to return the correct value? There may be other options that I'm not aware of.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question