Пример #1
0
        /// <summary>
        /// A simple function that takes a string and does a ToUpper
        /// </summary>
        /// <param name="input"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        public dynamic FunctionHandler(APIGatewayProxyRequest request, ILambdaContext context)
        {
            context.Logger.Log(request.ToString());

            return(new APIGatewayProxyResponse
            {
                StatusCode = 200,
                Headers = { },
                Body = "CC" + new Random().Next().ToString() + request.ToString()
            });
        }
Пример #2
0
        public async Task <APIGatewayProxyResponse> Run(APIGatewayProxyRequest request)
        {
            Console.WriteLine("TESTING THIS STUFF");
            Console.WriteLine(request.ToString());
            var requestModel = new GetItemRequest {
                Id = new Guid(request.PathParameters["id"])
            };
            var mediator = _serviceProvider.GetService <IMediator>();

            var result = await mediator.Send(requestModel);

            return(result == null ?
                   new APIGatewayProxyResponse {
                StatusCode = 404
            } :
                   new APIGatewayProxyResponse {
                StatusCode = 200, Body = JsonConvert.SerializeObject(result)
            });
        }