Hello
I have a grid displaying workitems and the last action taken for a workitem, recently I discovered that I need to extend this to include a history of actions stored in a separate table in the db.
the two tables looks like this:
workItem
id
name
lastActionDate
lastActionText
workAction
id
workItemID
actionDate
ActionText
My model currently looks like this:
public
class
workItemModel
{
public
int
id {
get
;
set
; }
public
string
name{
get
;
set
; }
public
DateTime lastActionDate{
get
;
set
; }
public
string
lastActionText{
get
;
set
; }
}
and my read action for the grid looks like this:
public
ActionResult workItems_Read([DataSourceRequest]DataSourceRequest request)
{
return
Json(GetWorkItems().ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
private
static
IEnumerable<workItemModel> GetWorkItems()
{
var wimDB =
new
wimDB_DEVEntities();
return
wimDB.workItem.Select(wiModel =>
new
workItemModel
{
id = wiModel.id,
name = wiModel.name,
lastActionDate = wiModel.lastActionDate,
lastActionText= wiModel.lastActionText
});
}
How do I extent my model and my read action to include the workAction table from the db?
/Jonas