예제 #1
0
 public async Task <List <PreviewDto> > GetAsync(FilterDto filter, CancellationToken cancellationToken)
 {
     return(await Query
            .WhereType(filter.TemplateType)
            .Select(EmailTemplateDocExpression.ToPreviewDto)
            .ToListAsync(cancellationToken));
 }
예제 #2
0
        public async Task <IActionResult> GetUserCredits([FromBody] FilterDto filterDto)
        {
            try
            {
                var credits = await _punctuationService.GetUserCredits(UserId, filterDto.CurrentMonth, filterDto.CurrentYear);

                if (credits.Any())
                {
                    _logger.Info($"Exibido lista de creditos do Usuario com id {UserId}");
                    return(Ok(credits));
                }
                else
                {
                    _logger.Info($"Exibicao lista de creditos do Usuario com id {UserId} - Nenhum crédito encontrado");
                    return(NotFound("Nenhum crédito encontrado"));
                }
            }
            catch (Exception ex)
            {
#if (!DEBUG)
                _logger.Fatal($"Exibicao lista de creditos do Usuario com id {UserId} - {ex.ToLogString(Environment.StackTrace)}");
#endif
                return(BadRequest($"Exibicao lista de creditos do Usuario com id {UserId} - {ex.ToLogString(Environment.StackTrace)}"));
            }
        }
        public List <ImageDto> Get(FilterDto filter, int?userId = null)
        {
            var minImageCountForPage = filter.ImagesOnPageCount.HasValue
                ? filter.ImagesOnPageCount.Value * (filter.PageNumber - 1) + 1
                : 0;

            using (var context = ContextFactory.CreateDbContext(ConnectionString))
            {
                IEnumerable <ImageDto> images = context.Images
                                                .Include(image => image.UserToImageScores)
                                                .ThenInclude(image => image.Score)
                                                .Include(image => image.UserToImageTags)
                                                .ThenInclude(image => image.Tag)
                                                .Where(image => filter.Tags == null || filter.Tags.Count() == 0
                        ? true
                        : image.UserToImageTags.Any(uit => filter.Tags.Contains(uit.Tag.Name)))
                                                .Select(image => new ImageDto(image, userId));
                if (filter.ImagesOnPageCount.HasValue)
                {
                    images = images
                             .Skip(minImageCountForPage - 1)
                             .Take(filter.ImagesOnPageCount.Value);
                }

                if (images.Count() == 0)
                {
                    throw new ImageRepositoryException("Недостаточно файлов для вывода страницы");
                }

                return(SortImages(images, filter));
            }
        }
        public async Task <IEnumerable <MenuItemDto> > GetAllMenuItemsWithFilters(FilterDto filters)
        {
            ISpecification <MenuItem> specification;

            var mealType  = filters.MealType;
            var allergens = filters.Allergens;

            if (!(mealType == MealType.Unknown) && allergens != null && allergens.Any())
            {
                var mealTypeSpec         = new MenuItemForMealTypeSpecification(mealType);
                var excludeAllergensSpec = new MenuItemForAllergensSpecification(allergens).Not();

                specification = mealTypeSpec.And(excludeAllergensSpec);
            }
            else if (allergens != null && allergens.Any())
            {
                specification = new MenuItemForAllergensSpecification(allergens).Not();
            }
            else
            {
                specification = new MenuItemForMealTypeSpecification(mealType);
            }

            var menuItems = await _menuItemRepository.All(specification);

            var menuItemDtos = _mapper.Map <IEnumerable <MenuItemDto> >(menuItems);

            return(menuItemDtos);
        }
예제 #5
0
        public async Task <IHttpActionResult> GetAll(FilterDto filter)
        {
            filter.StatusCode = 0;
            var result = await _wishRepository.GetWishes(filter);

            return(SuccessApiResult(result));
        }
예제 #6
0
        // GET: News
        public ActionResult Index(FilterDto filter)
        {
            var l = _manager.GetEventsList(filter);

            ViewBag.Filter = filter;
            return(View(l));
        }
예제 #7
0
        public Task <List <PeopleDto> > GetPeoplesAsync(FilterDto input)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            return(Task.FromResult(new List <PeopleDto>
            {
                new PeopleDto {
                    Name = "abc", Age = 1, Toys = new List <ToyDto> {
                        new ToyDto {
                            Name = "Lego", Amount = 100
                        }
                    }
                },
                new PeopleDto {
                    Name = "efg", Age = 2, Toys = new List <ToyDto> {
                        new ToyDto {
                            Name = "Lego", Amount = 50
                        }
                    }
                }
            }));
        }
예제 #8
0
        static void Main(string[] args)
        {
            var services = new ServiceCollection();

            services.AddSingleton <ICustomerService, CustomerService>();
            services.AddSingleton <ICustomerRepository, CustomerSqlRepository>();

            FilterDto filter = new FilterDto();
            var       config = new MapperConfiguration(cfg => {
                cfg.AddProfile(new MappingProfile());
            });
            IMapper mapper = config.CreateMapper();

            services.AddSingleton(mapper);

            IServiceProvider provider = services.BuildServiceProvider();

            ICustomerService customerService = provider.GetService <ICustomerService>();

            var customers = customerService.GetAllItems();

            foreach (var customer in customers)
            {
                System.Console.WriteLine(customer);
            }

            var filterDto = new FilterDto()
            {
                CompanyName = "ASD"
            };

            customers = customerService.Filter(filterDto);
            System.Console.ReadLine();
        }
예제 #9
0
        public virtual FilterDto createFilter(FilterDto filterDto)
        {
            FilterService filterService = ProcessEngine.FilterService;

            string resourceType = filterDto.ResourceType;

            Filter filter;

            if (EntityTypes.TASK.Equals(resourceType))
            {
                filter = filterService.newTaskFilter();
            }
            else
            {
                throw new InvalidRequestException(Response.Status.BAD_REQUEST, "Unable to create filter with invalid resource type '" + resourceType + "'");
            }

            try
            {
                filterDto.updateFilter(filter, ProcessEngine);
            }
            catch (NotValidException e)
            {
                throw new InvalidRequestException(Response.Status.BAD_REQUEST, e, "Unable to create filter with invalid content");
            }

            filterService.saveFilter(filter);

            return(FilterDto.fromFilter(filter));
        }
예제 #10
0
        /// <summary>
        /// 获取签到列表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <List <SignPointDto> > GetSignList(FilterDto input)
        {
            var points = await GetPointsFromCache();

            var users = await _userpointRepository.GetAllListAsync(c => c.UserId.Equals(input.UserId));

            var temp  = users.Select(c => c.PointId).ToList();
            var today = DateTime.Now.Date;
            var next  = today.AddDays(1);
            var signs = await _signRepository
                        .GetAllListAsync(c => c.CreationTime >= today && c.CreationTime < next);

            var result = from c in points.Where(c => temp.Contains(c.DeviceNum))
                         join d in signs on c.Id equals d.PointId into j
                         from jj in j.DefaultIfEmpty()
                         select new SignPointDto()
            {
                Id      = c.Id,
                PointId = c.DeviceNum,
                Point   = c.PointName,
                State   = jj != null
            };

            return(result.ToList());
        }
예제 #11
0
        protected FilterDto GetFilterDto()
        {
            var start               = Request.Form["start"].FirstOrDefault();
            var length              = Request.Form["length"].FirstOrDefault();
            var orderColumn         = Request.Form["order[0][column]"].FirstOrDefault();
            var sortColumn          = Request.Form["columns[" + orderColumn + "][name]"].FirstOrDefault();
            var sortColumnDirection = Request.Form["order[0][dir]"].FirstOrDefault();
            var searchValue         = Request.Form["search[value]"].FirstOrDefault();

            var skip = start != null?Convert.ToInt32(start) : 0;

            var pageSize = length != null?Convert.ToInt32(length) : 0;

            if (sortColumn == "LandlordId")
            {
                sortColumn = "LastName";
            }

            var result = new FilterDto()
            {
                Skip          = skip,
                PageSize      = pageSize,
                SortColumn    = sortColumn,
                SortDirection = sortColumnDirection,
                SearchValue   = searchValue
            };

            return(result);
        }
예제 #12
0
        /// <summary>
        /// 获取报警信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <WarnDto> GetWarnsByUser(FilterDto input)
        {
            var points = await GetPointsFromCache();

            var users = await _userpointRepository.GetAllListAsync(c => c.UserId.Equals(input.UserId));

            var warns = await _warnRepository.GetAllListAsync();

            var result = from c in users
                         join warn in warns on c.PointId equals warn.DeviceNum
                         join e in points on warn.DeviceNum equals e.DeviceNum
                         select new MobileWarnDto()
            {
                Content     = warn.WarnNum,
                Description = YtConsts.Types.FirstOrDefault(w => w.Type.Equals(warn.WarnNum))?.Chinese,
                DeviceId    = warn.DeviceNum,
                Id          = warn.Id,
                State       = warn.State,
                DeviceName  = e.SchoolName, WarnTime = warn.WarnTime
            };
            var now = DateTime.Now.Date;

            return(new WarnDto()
            {
                Anomaly = result.Where(c => !c.State).ToList(),
                Normal = result.Where(c => c.State).Where(c => c.WarnTime.Date == now).ToList()
            });
        }
예제 #13
0
        protected async Task ApplyFilter(FilterDto filterDto)
        {
            var queryResult = await PhotoService.GetAllPhotosAsync(Filter, null, 0, 20);

            Count  = queryResult.Count;
            Photos = queryResult.Photos;
        }
예제 #14
0
        public IActionResult GetSettlabeInterestSummary([FromBody] FilterDto filter)
        {
            var interestRates = GetInterestRates();
            List <LoanVoucher> vouchers;

            if (filter.Filter.ToLower() == "ysjs")
            {
                vouchers = _context.LoanVouchers.Include(p => p.Lender).Where(p => !p.IsInvalid && p.Amount > 0).ToList();
            }
            else
            {
                vouchers = _context.LoanVouchers.Include(p => p.Lender).Where(p => !p.IsInvalid && p.Amount > 0 && p.Lender.Name.Contains(filter.Filter)).ToList();
            }
            var dto = vouchers.Select(p => new
            {
                Lender   = p.Lender.Name,
                Amount   = p.Amount,
                Interest = p.CalculateQuarterInterest(interestRates)
            }).GroupBy(p => p.Lender).Select(p => new SettlableInterestSummaryDto
            {
                Lender        = p.Key,
                TotalAmount   = p.Sum(l => l.Amount),
                TotalInterest = p.Sum(l => l.Interest)
                ,
                Count = p.Count()
            });

            return(this.AlpsActionOk(dto));
        }
예제 #15
0
파일: Program.cs 프로젝트: san-had/MyToDo
        private async static Task Main()
        {
            Init();

            var toDo = new ToDoDto
            {
                Description = "Eleventh ToDo"
            };

            Console.WriteLine(CreateToDoRecord(toDo));

            var filter = new FilterDto
            {
                //DescriptionFilter = "First",
                //IsCompletedFilter = true
            };

            var paging = new PagingDto
            {
                PageSize   = 5,
                PageNumber = 1
            };

            DisplayToDos(await GetAll(filter, paging));
            //toDoService.DeleteToDoItem(3);
            //DisplayToDo(toDoService.GetToDoItemById(3));

            //var toDo = toDoService.GetToDoItemById(1);
            //toDo.IsCompleted = true;
            //toDoService.UpdateToDoItem(toDo);
            DisplayToDo(await toDoService.GetToDoItemByIdAsync(3));
            //DisplayToDos(GetAll());
        }
예제 #16
0
        public IEnumerable <Product> Filter(FilterDto filter)
        {
            var productList = cache.Get("productData") as IEnumerable <Product>;

            if (productList == null)
            {
                return(null);
            }
            productList = productList.Where(x => x.StockQuantity >= x.Category.MinimumStockQuantity);

            if (!string.IsNullOrEmpty(filter.Name))
            {
                productList = productList.Where(x => x.Title.IndexOf(filter.Name, StringComparison.OrdinalIgnoreCase) != -1 ||
                                                x.Description.IndexOf(filter.Name, StringComparison.OrdinalIgnoreCase) != -1 ||
                                                x.Category.Name.IndexOf(filter.Name, StringComparison.OrdinalIgnoreCase) != -1);
            }
            if (filter.StockRange != null && filter.StockRange.Any())
            {
                var min = Math.Min(filter.StockRange[0], filter.StockRange[1]);
                var max = Math.Max(filter.StockRange[0], filter.StockRange[1]);

                productList = productList.Where(x => x.StockQuantity >= min && x.StockQuantity <= max);
            }
            return(productList);
        }
        public async Task <IHttpActionResult> GetAll(FilterDto filter)
        {
            filter.StatusCode = 0;//только открытые
            var result = await _giftRepository.GetGifts(filter);

            return(SuccessApiResult(result));
        }
예제 #18
0
        public async Task <DocumentSearchResultDto <DocumentIndexDto> > Get(FilterDto filter, string projectId, string branchName)
        {
            if (!IsServiceAlive())
            {
                return(new DocumentSearchResultDto <DocumentIndexDto>());
            }

            var client = GetClient();
            var query  = CreateQuery(filter);

            var requestUri = Path.Combine(_baseAddress, $"search/projects/{projectId}/branches/{branchName}");

            if (!string.IsNullOrWhiteSpace(query))
            {
                requestUri += $"?{query}";
            }

            _logger.LogInformation($"Indexer client request (GET): {requestUri}");
            var response = await client.GetAsync(requestUri);

            if (response.StatusCode == HttpStatusCode.OK)
            {
                var responseString = await response.Content.ReadAsStringAsync();

                var deserializedObject = JsonConvert.DeserializeObject <DocumentSearchResultDto <DocumentIndexDto> >(responseString);
                return(deserializedObject);
            }

            return(new DocumentSearchResultDto <DocumentIndexDto>());
        }
예제 #19
0
        public async Task UpdateLots_When_Filter_Exist_Should_Return_NewLotDtosModel()
        {
            //arrange
            int id            = 1;
            var currentFilter = new Filter {
                FilterName = "Filter Name", Content = "Filter Content"
            };
            var       newLots          = new List <Lot>();
            var       newLotsDto       = new List <LotDto>();
            FilterDto currentFilterDto = new FilterDto {
                FilterName = "Filter Name", Content = "Filter Content"
            };
            var expectedResult = new NewLotDtosModel {
                FilterDto = currentFilterDto, FreshLots = newLotsDto
            };

            unitOfWork.Setup(x => x.Filters.GetById(id)).Returns(currentFilter);
            filterModelFactory.Setup(x => x.CreateFilterDto(currentFilter)).Returns(currentFilterDto);
            htmlParserProvider.Setup(x => x.GetLotsByFilter(It.IsAny <String>()))
            .Returns(Task.FromResult(newLotsDto));
            unitOfWork.Setup(x => x.Lots.GetAll).Returns(newLots);
            lotModelFactory.Setup(x => x.CreateNewLotDtosModel(currentFilterDto, newLots)).Returns(expectedResult);

            //act
            var actualResult = await underTest.UpdateLots(id);

            //assert
            Assert.AreEqual(expectedResult, actualResult);
            htmlParserProvider.Verify(x => x.GetLotsByFilter(currentFilter.Content));
            unitOfWork.Verify(x => x.SaveChanges());
        }
예제 #20
0
        public async Task <IActionResult> PreProcessingSales(FilterDto filterDto)
        {
            try
            {
                var result = await _reportService.PreProcessingSales(filterDto);

                if (result.hasReport)
                {
                    _logger.Info($"Tentativa gerar relatório de pre processamento de venda com usuario id :{UserId} - relatorio gerado com sucesso!");
                    return(Ok(result.report));
                }
                else
                {
                    _logger.Warn($"Tentativa gerar relatório de pre processamento de venda com usuario id:{UserId} - Não foi encontrado registro no mes {filterDto.CurrentMonth} ano {filterDto.CurrentYear} e rede {filterDto.Network}");
                    return(NotFound(result.message));
                }
            }
            catch (Exception ex)
            {
#if (!DEBUG)
                _logger.Fatal($"Tentativa gerar relatório de pre processamento de venda com usuario id:{UserId} - {ex.ToLogString(Environment.StackTrace)} - no mes {filterDto.CurrentMonth} ano {filterDto.CurrentYear} e rede {filterDto.Network}");
#endif
                return(BadRequest($"Tentativa gerar relatório de pre processamento de venda com usuario id:{UserId} - {ex.ToLogString(Environment.StackTrace)} - no mes {filterDto.CurrentMonth} ano {filterDto.CurrentYear} e rede {filterDto.Network}"));
            }
        }
예제 #21
0
        public Object Vacancies([FromQuery] int?count,
                                [FromQuery] int offset, [FromQuery] string search, [FromQuery] FilterDto filter)
        {
            var vacanciesAmount = _databaseContext.Vacancies.Count();

            search = search ?? "";
            count  = count ?? vacanciesAmount;

            var filteredVacancies = _databaseContext.Vacancies
                                    .Where(x => (filter == null || filter.Departures == null ? x.DepartureName : filter.Departures) ==
                                           x.DepartureName)
                                    .Where(x => (filter == null || filter.Status == null ? x.Status : filter.Status) == x.Status)
                                    .Where(x =>
                                           (filter == null || filter.BranchOffice == null ? x.BranchOfficeCity : filter.BranchOffice) ==
                                           x.BranchOfficeCity)
                                    .Where(x => x.Name.ToLower().Contains(search.ToLower()));

            var vacancies = filteredVacancies
                            .OrderByDescending(x => x.CreationDate)
                            .Skip(offset)
                            .Take((int)count);

            var vacanciesDto = new List <VacanciesDto>();

            foreach (var vacancy in vacancies)
            {
                vacanciesDto.Add(_mapper.Map <Vacancy, VacanciesDto>(vacancy));
            }

            var total = filteredVacancies.Count();

            return(new { data = vacanciesDto, total });
        }
        public async Task GetAllMenuItemsWithFilters_ReturnsMenuItemDtos()
        {
            var SUT = Setup();

            var expectedResult = MenuItems.Select(x => new MenuItemDto
            {
                Id        = x.Id,
                Name      = x.Name,
                Price     = x.Price,
                MealType  = x.MealType,
                Allergens = x.Allergens.Select(y => new AllergenDto
                {
                    Id           = y.Id,
                    AllergenType = y.AllergenType,
                }),
            });

            var filterDto = new FilterDto
            {
                MealType  = MealType.Starter,
                Allergens = new List <AllergenType>
                {
                    AllergenType.Soya,
                },
            };
            var result = await SUT.GetAllMenuItemsWithFilters(filterDto);

            result.Should().BeEquivalentTo(expectedResult);
        }
예제 #23
0
        public async Task <QueryResultDto <VehicleDetailsDto> > GetVehicles([FromQuery] FilterDto filterDto)
        {
            var filter   = mapper.Map <FilterDto, Filter>(filterDto);
            var vehicles = await repository.GetVehicles(filter);

            return(mapper.Map <QueryResult <Vehicle>, QueryResultDto <VehicleDetailsDto> >(vehicles));
        }
예제 #24
0
        public List <EventTopDto> GetTops(FilterDto filter)
        {
            var iqu = ImplementFilters(filter);
            IQueryable <EventTopDto> tops;

            if (filter.Type == EventTypeEnum.Sms)
            {
                tops = iqu.GroupBy(a => a.MsIsdn.MsIsdnNumber)
                       .Select(g =>
                               new EventTopDto
                {
                    MsIsdnNumber = g.Key,
                    Number       = g.Count()
                });
            }
            else
            {
                tops = iqu.GroupBy(a => a.MsIsdn.MsIsdnNumber)
                       .Select(g =>
                               new EventTopDto
                {
                    MsIsdnNumber = g.Key,
                    Number       = g.Sum(a => a.Duration == null ? 0 : (int)a.Duration)
                });
            }
            return(tops.OrderByDescending(o => o.Number).Take(5).ToList());
        }
예제 #25
0
        public IDataResult <List <CarDetailDto> > GetWithDetails(FilterDto filter)
        {
            //Expression propertyExp, someValue, containsMethodExp, combinedExp;
            //Expression<Func<CarDetailDto, bool>> exp = c => true, oldExp;
            //MethodInfo method;

            //var parameterExp = Expression.Parameter(typeof(CarDetailDto), "type");
            //foreach (PropertyInfo propertyInfo in filter.GetType().GetProperties())
            //{
            //    if (propertyInfo.GetValue(filter,null) != null)
            //    {
            //        oldExp = exp;
            //        propertyExp = Expression.Property(parameterExp, propertyInfo.Name);
            //        method = typeof(object).GetMethod("Equals", new[] { typeof(object) });
            //        someValue = Expression.Constant(filter.GetType().GetProperty(propertyInfo.Name).GetValue(filter,null),typeof(object));
            //        containsMethodExp = Expression.Call(propertyExp, method, someValue);
            //        exp = Expression.Lambda<Func<CarDetailDto, bool>>(containsMethodExp, parameterExp);
            //        combinedExp = Expression.AndAlso(exp.Body, oldExp.Body);
            //        exp = Expression.Lambda<Func<CarDetailDto, bool>>(combinedExp, exp.Parameters[0]);
            //    }
            //}

            var exp = Filter.DynamicFilter <CarDetailDto, FilterDto>(filter);


            return(new SuccessDataResult <List <CarDetailDto> >(_carDal.GetCarDetailsFatih(exp)));
        }
예제 #26
0
        public async Task <ToDoItemListViewModel> GetToDoListAsync(FilterDto filter, int currentPage)
        {
            var paging = new PagingDto
            {
                PageSize   = pageSize,
                PageNumber = currentPage
            };

            var toDos = await toDoService.GetAllAsync(filter, paging);

            var toDoItemViewList = toDoConverter.ConvertToViewModelList(toDos);

            int recordCount = await toDoService.GetAllRecordCountAsync(filter);

            var viewModel = new ToDoItemListViewModel
            {
                ToDoItemViewList  = toDoItemViewList,
                PageCount         = toDoService.GetPageCount(recordCount, pageSize),
                DescriptionFilter = filter.DescriptionFilter,
                IsCompletedFilter = filter.IsCompletedFilter,
                BothFilter        = filter.BothFilter,
                CurrentPage       = currentPage
            };

            return(viewModel);
        }
        public async Task <IActionResult> ApproveFiles(FilterDto filterDto)
        {
            try
            {
                var result = await _saleFileService.DoApprove(filterDto);

                if (result)
                {
                    _logger.Info($"tentativa aprovação arquivo de venda com o usuario {UserId} com os parametros de mes {filterDto.CurrentMonth} ano {filterDto.CurrentYear} e rede {Network} - files aprovado com sucesso, aguardando processamento");
                    return(Ok($"tentativa aprovação arquivo de venda com o usuario {UserId} com os parametros de mes {filterDto.CurrentMonth} ano {filterDto.CurrentYear} e rede {Network} - files aprovado com sucesso, aguardando processamento"));
                }
                else
                {
                    _logger.Warn($"tentativa aprovação arquivo de venda com o usuario {UserId} com os parametros de mes {filterDto.CurrentMonth} ano {filterDto.CurrentYear} e rede {Network} - não foi possivel localizar arquivos nos parametros informado");
                    return(NotFound("Não foi possivel localizar arquivos nos parametros informado"));
                }
            }
            catch (Exception ex)
            {
#if (!DEBUG)
                _logger.Fatal($"tentativa aprovação arquivo de venda com o usuario {UserId} com os parametros de mes {filterDto.CurrentMonth} ano {filterDto.CurrentYear} e rede {Network} - {ex.ToLogString(Environment.StackTrace)}");
#endif
                return(BadRequest($"tentativa aprovação arquivo de venda com o usuario {UserId} com os parametros de mes {filterDto.CurrentMonth} ano {filterDto.CurrentYear} e rede {Network} - {ex.ToLogString(Environment.StackTrace)}"));
            }
        }
예제 #28
0
        public List <Customer> Filter(FilterDto filter)
        {
            var respoFilter = mapper.Map <FilterRepositoryDto>(filter);
            var customers   = customerRepository.GetCustomers(respoFilter);

            return(customers);
        }
예제 #29
0
        public async Task <OperationDetails> Create(FilterDto filterDto)
        {
            logger.Info($"Create filter {filterDto.FilterName}");
            try
            {
                var filter = unitOfWork.Filters.SingleOrDefault(f =>
                                                                f.ApplicationUserId.Equals(filterDto.ApplicationUserId) &&
                                                                f.FilterName.Equals(filterDto.FilterName));
                if (filter != null)
                {
                    logger.Error($"User already have a filter with name \"{filterDto.FilterName}\"");
                    return(new OperationDetails(false,
                                                $"You already have a filter with name \"{filterDto.FilterName}\"", ""));
                }

                filter = filterModelFactory.CreateFilter(filterDto);
                unitOfWork.Filters.Create(filter);
                await unitOfWork.SaveChanges();

                logger.Info($"Filter \"{filterDto.FilterName}\" was created successfully");
                return(new OperationDetails(true, $"Filter \"{filterDto.FilterName}\" was created successfully", ""));
            }
            catch (DataException e)
            {
                unitOfWork.RollBack();
                logger.Error(e.Message);
                throw new DataException(e.Message);
            }
        }
예제 #30
0
        public async Task <IEnumerable <ToDoDto> > GetAllAsync(FilterDto filter, PagingDto paging)
        {
            IQueryable <ToDoDbModel> toDbModels = FilterToDoDbModel(filter);

            var toDbModelsList = await toDbModels.Skip(paging.PageNumber *paging.PageSize).Take(paging.PageSize).ToListAsync();

            return(toDbModelsList.Select(toDbModel => toDoEntityConverter.Convert(toDbModel)));
        }