Answer the question
In order to leave comments, you need to log in
Asp.net mvc data type for money?
public virtual decimal ProductPrice { get; set; }
It turns out that in the database it is saved with a comma, but on the form it asks to enter with a dot, which is why the value is not saved.
How to properly organize work with "Money" What type of data should be and what attributes?
Answer the question
In order to leave comments, you need to log in
A year and a half has passed! But I want to give an answer)) When I encountered this trouble, the solution was found to be ideal - I added the methods_ru.js script to the validator on the form. I have been using for many years. Here is where I found it.
If the database server and IIS are on different servers, then you need to check that the default cultures match, in Russian culture the fractional separator is a comma, in en-US a comma separates the discharge, and the fractional part is separated by a dot. It may be necessary to force the culture to be used in the MVC application.
use decimal, what culture is there on the database server - it doesn't matter, the main thing for you in your application is to get the correct decimal from the form and that's it, and then just put it in the database, the main thing is that the types match.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question