Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I am working on a C# E-Commerce application.

I want to add 100 to the calculated grand total value in the front end Cart.cshtml File.

What can I add this value in the Cart.cshtml file?

https://i.stack.imgur.com/L0vMe.png[^]

https://i.stack.imgur.com/myqby.png[^]

What I have tried:

I want to add 100 onto the calculated sum of the model values.
Posted
Updated 15-Nov-22 0:48am
Comments
Herman<T>.Instance 14-Nov-22 10:34am    
I am not clicking url's that say it is an image
Graeme_Grant 14-Nov-22 22:01pm    
How? Where? What have you tried?

Please update the question with more specifics, including the code that needs to change, what you have tried, and the error message that you get.

1 solution

You haven't shown any code, nor explained what the problem is.

Based on the vague description provided, you need:
Razor
<h3>Grand Total : @(Model.Sum(c => c.Price) + 100)</h3>
But this sort of code really belongs in the view-model, not the view itself.

Razor syntax reference for ASP.NET Core | Microsoft Learn[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900