I am new to asp.net mvc 5. I just build a new project using asp.net mvc 5 code first. One of my class's field names does not store in the database when I run the application.
Here is my code:
public class Read
{
[Required, Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
public long id_read { get; set; }
public long id_install { get; set; }
public int id_employee { get; set; }
public int read_result { get; set; }
public string digit_image { get; set; }
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
public DateTime read_date { get; set; }
[DataType(DataType.Currency)]
public decimal? price { get; set; }
[DataType(DataType.Currency)]
public decimal? total
{
get
{
return read_result * price;
}
}
}
Since the total
field name is the result of multiplication between read_result
and price
. So, I want to the total
field name store in the database. Please help me.