Beispiel #1
0
        public ActionResult Index(ModuleSearchInputDto input)
        {
            var output = _moduleAppService.SearchModules(input);

            var model = new ModuleListViewModel(output.Modules)
            {
                SelectedModuleState = input.State,
                SelectedUserId      = input.MemberId,
                SelectedProjectId   = input.ProjectId
            };

            var userList     = _userAppService.GetUsers().Result;
            var userFullList = new List <User> {
                new User {
                    Id = -1, UserName = "******"
                }
            }.Concat <User>(userList.Items);

            ViewBag.SelectedUserId = new SelectList(userFullList, "Id", "UserName", model.SelectedUserId);

            var projectList     = _projectAppService.SearchProjects(new Projects.Dto.ProjectSearchInputDto {
            });
            var projectFullList = new List <ProjectDto> {
                new ProjectDto {
                    Id = -1, Name = "All"
                }
            }.Concat <ProjectDto>(projectList.Projects);

            ViewBag.SelectedProjectId = new SelectList(projectFullList, "Id", "Name", model.SelectedProjectId);

            return(View(model));
        }
Beispiel #2
0
        public ActionResult Edit(UpdateModuleDto updateModuleDto)
        {
            _moduleAppService.UpdateModule(updateModuleDto);

            var input  = new ModuleSearchInputDto();
            var output = _moduleAppService.SearchModules(input);

            return(PartialView("_ListModules", output.Modules));
        }
Beispiel #3
0
        public ActionResult Create(CreateModuleDto module)
        {
            var id = _moduleAppService.CreateModule(module);

            var input  = new ModuleSearchInputDto();
            var output = _moduleAppService.SearchModules(input);

            return(PartialView("_ListModules", output.Modules));
        }
        public ModuleSearchOutputDto SearchModules(ModuleSearchInputDto input)
        {
            var query = _moduleRepository.GetAll();

            var currentTenant = _abpSession.TenantId;

            if (currentTenant.HasValue)
            {
                query = query.Where(t => t.TenantId == currentTenant);
            }

            if (input.MemberId.HasValue)
            {
                query = query.Where(t => t.MemberId == input.MemberId);
            }

            if (input.ProjectId.HasValue)
            {
                query = query.Where(t => t.ProjectId == input.ProjectId);
            }

            if (input.State.HasValue)
            {
                query = query.Where(t => t.State == input.State);
            }

            var list = query.ToList();

            if (currentTenant != null)
            {
                foreach (var module in list)
                {
                    if (module.MemberId.HasValue)
                    {
                        module.Member = _userRepository.Get(ObjectMapper.Map <long>(module.MemberId));
                    }

                    if (module.ProjectId.HasValue)
                    {
                        module.Project = _projectRepository.Get(ObjectMapper.Map <int>(module.ProjectId));
                    }
                }
            }

            return(new ModuleSearchOutputDto
            {
                Modules = Mapper.Map <List <ModuleDto> >(list)
            });
        }
Beispiel #5
0
        public PartialViewResult GetList(ModuleSearchInputDto input)
        {
            var output = _moduleAppService.SearchModules(input);

            return(PartialView("_ListModules", output.Modules));
        }