Exemple #1
0
 public async Task <ICollection <ProjectDto> > GetProjectsAsync(ProjectFilterDto filter, int userId, CancellationToken cancellationToken)
 {
     return(await NotDeletedSet
            .Where(e => e.UserId == userId)
            .OrderByDescending(e => e.Type)
            .Skip(filter.Skip)
            .Take(filter.Count)
            .ProjectTo <ProjectDto>(fMapper.ConfigurationProvider)
            .ToArrayAsync(cancellationToken));
 }
Exemple #2
0
 public IActionResult GetFilteredProjects([FromBody] ProjectFilterDto projectFilterDto)
 {
     try
     {
         var projects = _projectService.GetFilteredProjects(projectFilterDto.ProjectActivityTypes,
                                                            projectFilterDto.ProjectTypes,
                                                            projectFilterDto.PageIndex,
                                                            projectFilterDto.PageSize);
         var projectsCount = _projectService.GetFilteredProjectsCount(projectFilterDto.ProjectActivityTypes,
                                                                      projectFilterDto.ProjectTypes);
         return(Ok(new { projects, projectsCount }));
     }
     catch (Exception ex)
     {
         Logger.LogException(Log, ex, MethodBase.GetCurrentMethod());
         return(new StatusCodeResult(503));
     }
 }
        public List <ProjectDto> ProjectAll(ProjectFilterDto projectFilterDto)
        {
            if (projectFilterDto == null)
            {
                return(new List <ProjectDto>());
            }
            using (var unitOfWork = _unitOfWorkFactory.MakeUnitOfWork())
            {
                if (!projectFilterDto.IsPriority)
                {
                    projectFilterDto.Priority = null;
                }
                if (!projectFilterDto.IsSpervisorUser)
                {
                    projectFilterDto.SpervisorUserId = null;
                }
                if (!projectFilterDto.IsUser)
                {
                    projectFilterDto.UserId = null;
                }
                List <Project> projectList = unitOfWork.Project.GetFilter(
                    name: projectFilterDto.Name,
                    contractorCompany: projectFilterDto.ContractorCompany,
                    customerCompany: projectFilterDto.CustomerCompany,
                    isDatePeriod: projectFilterDto.IsDatePeriod,
                    dateBegin: projectFilterDto.DateBegin,
                    dateEnd: projectFilterDto.DateEnd,
                    priority: projectFilterDto.Priority,
                    supervisorUserId: projectFilterDto.SpervisorUserId,
                    userId: projectFilterDto.UserId
                    ).ToList();
                var projectResultList = Mapper.Map <List <ProjectDto> >(projectList);

                return(projectResultList);
            }
        }
Exemple #4
0
 public async Task <long> CountProjectsAsync(ProjectFilterDto filter, int userId, CancellationToken cancellationToken)
 {
     return(await NotDeletedSet
            .Where(e => e.UserId == userId)
            .CountAsync(cancellationToken));
 }