public ActionResult Index(int userId) { IEnumerable <TaskTrackDTO> taskTrackDTOs = _taskTrackService.GetTracksForUser(userId); var taskTrackListViewModel = new TaskTrackListViewModel { TaskTrackViewModels = _mapper.Map <IEnumerable <TaskTrackDTO>, IEnumerable <TaskTrackViewModel> >(taskTrackDTOs), UserId = userId }; return(View(taskTrackListViewModel)); }
public ActionResult Index(int?userId) { if (userId == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var tracks = _taskTrackService.GetTrackForUser(userId); var taskTracks = new TaskTrackListViewModel { TaskTrackViewModels = Mapper.Map <IEnumerable <TaskTrackDTO>, List <TaskTrackViewModel> >(tracks), UserId = userId.Value }; return(View(taskTracks)); }