I have got a LINQ to SQL entity class with an nullable int property called sTime which I am using to record number of seconds scheduled in for a task. e.g. database field 120000
I tried adding a property to the Task class but how do I initially set this property when I am using a LINQ to SQL entity.
public TimeSpan ScheduledTimeSpan {get; private set;}
int seconds = sTime ?? 0;
TimeSpan ts = new TimeSpan(0, 0, 0, seconds, 0);
ScheduledTimeSpan = ts;
I would do this in my View
<td><%= Html.Encode(task.ScheduledTimeSpan.TotalSeconds.ToString("hh:mm:ss")) %></td>
With MVC I am unsure on how and where to set and get sTime correctly when I am using UpdateModel(task); in my task controller. I was thinking I need to create a TimeSpan inside the controller action when doing the Get but that does not seem right to me, also where I should be setting this property? Anyone who can help?