Exemplo n.º 1
0
        public IActionResult GetAllTasks()
        {
            List <Task> allTasks = _taskService.GetAllTasks()
                                   .ToList();
            List <TaskViewModel> all = new List <TaskViewModel>();

            foreach (var task in allTasks)
            {
                TaskViewModel allTasksForList = new TaskViewModel
                {
                    Title       = task.Title,
                    Description = task.Description,
                    Priority    = task.Priority,
                    Status      = task.Status,
                    Type        = task.Type,
                };
                all.Add(allTasksForList);
            }

            AllTasksViewModel model = new AllTasksViewModel()
            {
                AllTasks = all
            };

            return(View(model));
        }
        public async Task <IActionResult> AllTasks()
        {
            if (!RoleHelper.UserIsAdmin(_database, User))
            {
                return(RedirectToAction("Index"));
            }

            var allTasks = (await _database.Tasks.ToListAsync())
                           .OrderBy(t => t.Status)
                           .Reverse();

            var viewModel = new AllTasksViewModel
            {
                AllTasks  = allTasks,
                UserNames = new Dictionary <Guid, string>()
            };



            var users = _database.Users.ToList();

            users.ForEach(u =>
            {
                viewModel.UserNames.Add(Guid.Parse(u.Id), u.UserName);
            });

            return(View(viewModel));
        }
Exemplo n.º 3
0
        public IActionResult AllTasks()
        {
            AllTasksViewModel model = new AllTasksViewModel();

            model.AdminTask = taskRepository.GetAll().Include(t => t.Location);
            GetLocations(model);
            return(View(model));
        }
        WorkspaceViewModel ListTasks()
        {
            TaskData          taskData  = _taskData;
            AllTasksViewModel workspace = new AllTasksViewModel(taskData);

            this.Workspaces.Add(workspace);
            return(workspace);
        }
Exemplo n.º 5
0
        public IActionResult Index()
        {
            var userId = this.userManager.GetUserId(this.User);
            var tasks  = this.taskService.GetAllForUserInViewModel <TaskInnerViewModel>(userId);

            var viewModel = new AllTasksViewModel {
                Tasks = tasks
            };

            return(this.View(viewModel));
        }
Exemplo n.º 6
0
        public IActionResult Index(int page = 1)
        {
            var companyId = this.companyService.GetIdByUserName(this.User.Identity.Name);
            var count     = this.taskService.GetCountForCompany(companyId);
            var tasks     = this.taskService.GetAllForCompanyInViewModel <TaskInnerViewModel>(companyId, ItemsPerPage, (page - 1) * ItemsPerPage);

            var viewModel = new AllTasksViewModel {
                Tasks = tasks, CurrentPage = page
            };

            viewModel.PagesCount = (int)Math.Ceiling((double)count / ItemsPerPage);
            return(this.View(viewModel));
        }
Exemplo n.º 7
0
        public ActionResult ViewAll()
        {
            AllTasksViewModel allTasks = new AllTasksViewModel();

            return(View("ViewAll", allTasks));
        }
 public TaskManagerWindowViewModel(AllTasksViewModel allCurrentTaskViewModel, FilteredTasksViewModel filteredTasksViewModel)
 {
     AllCurrentTaskViewModel = allCurrentTaskViewModel;
     FilteredTasks           = filteredTasksViewModel;
 }