예제 #1
0
        public IActionResult Index()
        {
            ViewBag.ProductCount    = _productRepo.GetAll().Count();
            ViewBag.ServiceCount    = _serviceRepo.GetAll().Count();
            ViewBag.TechnologyCount = _technologyRepo.GetAll().Count();
            ViewBag.SolutionCount   = _solutionRepo.GetAll().Count();

            return(View());
        }
예제 #2
0
        public async Task <IActionResult> EditRedirect(Guid?id)
        {
            if (!id.HasValue || id.Value == Guid.Empty)
            {
                return(UnprocessableEntity());
            }

            var projectGroups = Mediator.Send(new GetProjectGroupListQuery {
                HasAccessToAllEntities = User.UserHasThisPermission(Permissions.ProjectUpdate)
            }).Result;

            if (projectGroups != null)
            {
                ViewBag.ProjectGroups = projectGroups.ProjectGroups.Select(pg => new SelectListItem
                {
                    Value = pg.Id.ToString(),
                    Text  = pg.Name
                }).ToList();
            }

            ViewBag.ProjectId = id.Value;

            ViewBag.SolutionTypes   = _solutionTypeRepo.GetAll().ToList();
            ViewBag.ServiceTypes    = _serviceTypeRepo.GetAll().ToList();
            ViewBag.TechnologyTypes = _technologyTypeRepo.GetAll().ToList();
            ViewBag.ProductTypes    = _productTypeRepo.GetAll().ToList();

            var request = await Mediator.Send(new GetProjectDetailQuery { Id = id.Value });

            if (request != null)
            {
                return(View("Edit", Mapper.Map <UpdateProjectCommand>(request)));
            }

            return(BadRequest());
        }