Example #1
0
        public async Task <IActionResult> Get(int id)
        {
            var query = new CampaignGetQuery(id);

            var result = await _mediator.Send(query);

            return(Response(result));
        }
Example #2
0
        public async Task <IResponseModel <CampaignResponse> > Handle(CampaignGetQuery request,
                                                                      CancellationToken cancellationToken)
        {
            var campaign = await _campaignQueryService.FindAsync(request.CampaignId);

            if (campaign == null)
            {
                return(new NotFoundResponse <CampaignResponse>("No campaigns could be found with this id"));
            }

            return(new SuccessResponse <CampaignResponse>(_mapper.Map <CampaignResponse>(campaign)));
        }