Beispiel #1
0
        public ListAssignmentForListVm GetAllActiveAssignmentsForList(int pageSize, int pageNumber, string searchString)
        {
            var assignments = _assignmentRepository.GetAllActiveAssignments().Where(p => p.Name.StartsWith(searchString))
                              .ProjectTo <AssignmentForListVm>(_mapper.ConfigurationProvider).ToList();
            var assignmentsToShow = assignments.Skip(pageSize * (pageNumber - 1)).Take(pageSize).ToList();
            var assignmentList    = new ListAssignmentForListVm()
            {
                PageSize     = pageSize,
                CurrentPage  = pageNumber,
                SearchString = searchString,
                Assignments  = assignmentsToShow,
                Count        = assignments.Count
            };

            return(assignmentList);
        }