1
You guys, good morning.
I have a class that has a decimal field where I keep the price. So far so good. When it is displayed in the /Edit/ page, also ta beauty. But here’s the problem: 1 - The MVC (which I am using 4 with EF 6) it displays in the input the field with ,00 then when I save it does not leave stating that the format is incorrect (EF validate). 2 - If I put the . 00, it passes 3 - if it is for some value of type: 14.90 (14.90 in real) it sends to the bank 14900
How could I solve this problem?
Follows the class:
public class Opcional
{
public Opcional()
{
this.Diarias = new HashSet<Diaria>();
}
[Key]
public int OpcionalId { get; set; }
[Required]
public String Descricao { get; set; }
[Required]
public decimal Valor { get; set; }
public virtual ICollection<Diaria> Diarias { get; private set; }
}
Excerpt from my edit code:
<div class="col-md-12">
<div class="col-md-2">@Html.LabelFor(model => model.Valor)</div>
<div class="col-md-10">
@Html.EditorFor(model => model.Valor)
@Html.ValidationMessageFor(model => model.Valor)
</div>
</div>