Пример #1
0
        public async Task <ActionResult> Index()
        {
            IndexViewModel viewModel = new IndexViewModel();

            IEnumerable <TaskItem> tasks = await taskClient.GetAllTasks();

            if (tasks != null)
            {
                viewModel.TaskList = tasks;
            }

            return(View(viewModel));
        }
        public async Task <ActionResult> Index()
        {
            IndexViewModel viewModel = new IndexViewModel();

            IEnumerable <TaskItem> tasks = await taskClient.GetAllTasks();

            if (tasks != null)
            {
                viewModel.TaskList = tasks;

                viewModel.SelectTaskList = tasks.Select(t => new SelectListItem()
                {
                    Text = t.Title, Value = t.Id.ToString()
                });
            }

            return(View(viewModel));
        }