Exemplo n.º 1
0
        public Task <ObjectResult> GetAsync([FromRoute(Name = "id")] int id, [FromQuery] GetValuesRequest value)
        {
            return(DoAsync(async() =>
            {
                _log.Info("info");
                _log.Debug("Debug");
                _log.Error("Error");
                _log.Warn("Warn");

                throw new ServiceException(AllServiceErrors.TestError.WithMessageParameters("Billy"));
                //throw new Exception("test Exception");

                await _distributedCache.SetAsync("hello", Encoding.UTF8.GetBytes("world22222"),
                                                 new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromMinutes(5)));
                var _ = await _distributedCache.GetAsync("hello");
                return new GetValuesResponse
                {
                    Details = _mapper.Map <DetailDto>(_valuesRepository.GetDetail()),
                    //new DetailDto {DetailInt = 1, DetailStr = "dsf"},
                    Result = _valuesRepository.GetValues(id)
                };
            }));

            //return new string[] { "value1", "value2" };
        }
Exemplo n.º 2
0
        public async Task <ActionResult <IEnumerable <string> > > Get()
        {
            var request  = new GetValuesRequest();
            var response = await _mediator.Send(request);

            return(new ActionResult <IEnumerable <string> >(response));
        }
Exemplo n.º 3
0
 public GetTypeAccessResponse GetTypeAccess(GetValuesRequest request)
 {
     return(WrapResponse <GetTypeAccessResponse, GetTypeAccessResponseBody>(
                new ServiceExecutionDelegator <GetTypeAccessResponseBody, GetValuesRequestBody>().ResolveRequest(request.Request, (request.Request.Platform ?? ConfigurationManager.AppSettings["DefaultPlatform"]), ApiServiceName.GetTypeAccess)));
 }
Exemplo n.º 4
0
        public async Task <IEnumerable <string> > Handle(GetValuesRequest request, CancellationToken cancellationToken)
        {
            await Task.Delay(5, cancellationToken);

            return(_repository.GetValues());
        }