Esempio n. 1
0
    public virtual async Task <JsonResult> Get()
    {
        var q      = new GetAppAppListQuery();
        var result = await _mediator.Send(q).ConfigureAwait(false);

        return(new JsonResult(result));
    }
Esempio n. 2
0
    public async Task <QueryResponse <List <GetApplicationListResponse> > > Handle(GetAppAppListQuery request, CancellationToken cancellationToken)
    {
        var result = await _dataLayer.TblApplications.ToListAsync(cancellationToken : cancellationToken);

        if (!result.Any())
        {
            return(new QueryResponse <List <GetApplicationListResponse> >()
            {
                Message = $"No applications exist",
                HttpStatusCode = HttpStatusCode.NotFound
            });
        }

        var r = result.Adapt <List <GetApplicationListResponse> >();

        return(new QueryResponse <List <GetApplicationListResponse> >()
        {
            Response = r
        });
    }