public WorkItemEntity AddWorkItem(WorkItemEntity workItem) { WorkItem l_workItem = new WorkItem(); l_workItem.Title = workItem.Title; l_workItem.StatusId = workItem.StatusId; l_workItem.ProjectId = workItem.ProjectId; l_workItem.WorkItemTypeId = workItem.WorkItemTypeId; l_workItem.AssignTo = workItem.AssignTo; l_workItem.Description = workItem.Description; l_workItem.EstimateTime = workItem.EstimateTime; l_workItem.ActualTime = workItem.ActualTime; l_workItem.Priority = workItem.Priority; l_workItem.WorkItemGroupId = workItem.WorkItemGroupId; ChangeHistory history = new ChangeHistory(); history.ActualTime = workItem.ActualTime; history.AssignTo = workItem.AssignTo; history.ChangeTime = DateTime.Now; history.EstimateTime = workItem.EstimateTime; history.Priority = workItem.Priority; history.ProjectId = workItem.ProjectId; history.StatusId = workItem.StatusId; history.Title = workItem.Title; history.WorkItemTypeId = workItem.WorkItemTypeId; l_workItem.ChangeHistories.Add(history); dataContext.WorkItems.Add(l_workItem); dataContext.SaveChanges(); return workItem; }
public WorkItemEntity AddWorkItem(WorkItemEntity workItem) { WorkItem l_workItem = new WorkItem(); l_workItem.Title = workItem.Title; l_workItem.StatusId = workItem.StatusId; l_workItem.ProjectId = workItem.ProjectId; l_workItem.WorkItemTypeId = workItem.WorkItemTypeId; l_workItem.AssignTo = workItem.AssignTo; l_workItem.Description = workItem.Description; l_workItem.EstimateTime = workItem.EstimateTime; l_workItem.ActualTime = workItem.ActualTime; l_workItem.Priority = workItem.Priority; l_workItem.WorkItemGroupId = workItem.WorkItemGroupId; dataContext.WorkItems.Add(l_workItem); dataContext.SaveChanges(); return workItem; }