I am going to Explain How we create Default values for model Entities. So Let’s start this via taking a simple example Model class called Post. In Post Model class I have created property PostedOn. Following is a code for that.
private DateTime mPostedOn = DateTime.Now;
public DateTime PostedOn
{
get
{
return mPostedOn;
}
set
{
mPostedOn = value;
}
}
@Html.EditorFor(model=> model. mPostedOn)