// GET: WorkItems/Create public ActionResult Create() { //Create an empty work item WorkItem workItem = new WorkItem() { ProjectId = ProjectId }; //Set initial values to the view model that will be rendered in the view WorkItemViewModel wItem = TheModelFactory.Create(workItem); wItem.Mode = Mode.Create; wItem.DueDate = DateTime.Now.Date; wItem.ProjectName = ProjectViewModelSession.ProjectName; //Set the list of team members that will be shown in the drop down for selection IEnumerable <TeamMemberViewModel> teamMemberList = ProjectViewModelSession.TeamMembersViewModel; wItem.TeamMemberList = new SelectList(teamMemberList, "TeamMemberId", "FullName"); //Wrap the container WorkItemContainerViewModel container = new WorkItemContainerViewModel() { WorkItemsMenu = MenuWorkItemsSession, WorkItemViewModel = wItem }; return(View(container)); }
// GET: WorkItems/Edit/5 public ActionResult Edit(int id) { //Get information about the specific workItem WorkItem workItem = _workItemsManager.GetWorkItem(id); WorkItemViewModel wItem = TheModelFactory.Create(workItem); wItem.Mode = Mode.Edit; wItem.ProjectName = this.ProjectViewModelSession.ProjectName; IEnumerable <TeamMemberViewModel> teamMemberList = ProjectViewModelSession.TeamMembersViewModel; wItem.TeamMemberList = new SelectList(teamMemberList, "TeamMemberId", "FullName"); WorkItemContainerViewModel container = new WorkItemContainerViewModel() { WorkItemViewModel = wItem, WorkItemsMenu = MenuWorkItemsSession }; return(View(container)); }