Beispiel #1
0
    public async Task <ICollection <CategoryDto> > Handle(GetCategoriesCommand request,
                                                          CancellationToken cancellationToken)
    {
        var categories = await _categoryService.GetCategoryList();

        return(_mapper.Map <ICollection <CategoryDto> >(categories));
    }
        public List <KeyValueItem> GetCategories()
        {
            var command = new GetCategoriesCommand();

            command.Execute();

            return(command.CommandResult);
        }
Beispiel #3
0
        public void Execute(GetCategoriesArgs args)
        {
            var classifier = new CategorizingClassifier();
            var provider   = new ShapefileFeatureCollectionProvider(args.PathToShapefile);
            var cmd        = new GetCategoriesCommand(classifier, provider.Get);
            var req        = Mapper.Map <GetCategoriesRequest>(args);
            var res        = cmd.Execute(req);

            res.MatchSome(x =>
            {
                var json = JsonConvert.SerializeObject(x.Result);
                Console.WriteLine(json);
            });

            res.MatchNone(x =>
            {
                Log.Error(
                    x,
                    "Failed to categorize data set from shapefile {Shapefile",
                    args.PathToShapefile);
            });
        }