I am using web api 2 with entity framework v 6.0.0 . I have a table that contains a date column called StudyGroupStartDate so i used the data annotations like this:
[Column(TypeName = "Date")]
public DateTime? StudyGroupStartDate { get; set; }
And this is how it is saved in the database : 7/20/2015. However when i retrieve it and display it is returned like this : 2015-07-20T00:00:00 (I want it to be like how it's saved in the database)
Note that i am not using MVC , i created an empty web application and chose web api so i am just using controllers that were generated using the model.And this is an example of my controller.
// GET: api/StudyGroups
public List<StudyGroup> GetStudyGroups()
{
return db.StudyGroups.Where(a=>a.IsDeleted==false).ToList();
}
I just changed the generated code of the GET request to retrieve the result as a list with a condition of is_deleted to be false.