You can define a new property in your model:
public DateTime StartDate{ get; set; } public DateTime EndDate{ get; set; } public TimeSpan CalculateTime{ get { return EndDate.Subtract(StartDate); } }
Now you can use something like this:
var query = from temp in db.Table select new MyModel { Id = temp.Id, Variable1 = temp.Variable1, ... EndDate = temp.EndDate, StartDate = temp.StartDate }
When you look at the result, you can use return, for example:
return query
Now in the request we have CalculateTime (subtract from EndDate and Startdate).
oknevermind Dec 12 '16 at 15:47 2016-12-12 15:47
source share