I am new to Entity Framework. I started with database first approach which created my classes corresponding to the tables I selected. I am using MVC
. One of my tables has a Date
column in it. My requirement is I want to display the Day in my gridview
(Grid MVC) i.e. if Date for that particular record fetched is 10/27/2015, then Day should show Tues. I want to do this without adding an extra column for the day in my database.
Is there a way for this. Any help will be greatly appreciated.
My model class generated is as below:-
public partial class QnsNew1
{
public int Id { get; set; }
public Nullable<System.DateTime> Date { get; set; }
public Nullable<int> PersonelID { get; set; }
public string CType { get; set; }
public string Comments { get; set; }
//public string Day { get; set; }//I want to avoid doing this
public virtual Personnel Personnel { get; set; }
public virtual Type Type { get; set; }
}
.cshmtl
views? If so I would suggest just binding whatever is in that view tomodel.Date.DayOfWeek
instead of adding anything to the model.