/**
         * Method that returns a search result
         * */
        public async Task <List <SearchAssetResult> > Handle(SearchAssetCriteria message, CancellationToken cancellationToken)
        {
            var query = from historicalStages in context.HistoricalStages
                        join assets in context.Assets on historicalStages.AssetId equals assets.Id
                        join assetDefendant in context.AssetDefendants on assets.Id equals assetDefendant.AssetId
                        join person in context.Persons on assetDefendant.PersonId equals person.Id
                        join stages in context.Stages on historicalStages.StageId equals stages.Id

                        where historicalStages.DecisionNumber == message.DecisionNumber
                        where historicalStages.FileNumber == message.FileNumber
                        where historicalStages.Person.Identification == message.DefendantId //maybe should be changed
                        where historicalStages.Person.Name == message.DefendantName
                        select new SearchAssetResult
            {
                Id             = historicalStages.DecizieId,
                DefendantName  = person.Name,
                DecisionNumber = historicalStages.DecisionNumber,
                FileNumber     = historicalStages.FileNumber,
                Stage          = historicalStages.Stage.Name,
                AssetId        = assets.Id
            };

            return(await query.ToListAsync(cancellationToken));
        }
Exemple #2
0
        public async Task <IActionResult> SearchAsset(SearchAssetCriteria assetCriteria)
        {
            var results = await mediator.Send(assetCriteria);

            return(Ok());
        }