示例#1
0
        public async Task <IActionResult> GetOrders()
        {
            try
            {
                var orders = await _orderQueries.GetOrders();

                return(Ok(orders));
            }
            catch (Exception)
            {
                return(NotFound());
            }
        }
示例#2
0
        public async Task <IActionResult> Get()
        {
            try
            {
                var data = await _orderQueries.GetOrders();

                return(Ok(new ApiOkResponse(data, data.Count())));
            }
            catch (Exception ex)
            {
                _logger.LogCritical(ex, "Error on Get Orders");
                return(BadRequest(new ApiBadRequestResponse(500, "Something Wrong")));
            }
        }
示例#3
0
        public async Task <IActionResult> Get()
        {
            try
            {
                var data = await _orderQueries.GetOrders();

                var response = _mapper.Map <List <DetailOrderResponse> >(data);

                return(Ok(new ApiOkResponse(response, response.Count())));
            }
            catch (Exception ex)
            {
                _logger.LogCritical(ex, "Error on Get Orders");
                return(BadRequest(new ApiBadRequestResponse(500, "Something Wrong")));
            }
        }
示例#4
0
        public async Task <IActionResult> GetAllOrders(string correlationToken)
        {
            Guard.ForNullOrEmpty(correlationToken, "correlationToken");

            var orders = await _orderQueries.GetOrders(correlationToken);

            if (orders == null)
            {
                return(new ObjectResult(new List <OrderDetailDto>()));
            }

            // Map Order to OrderDto
            var OrderDto = Mapper.MapToOrdersDto(orders);

            return(new ObjectResult(OrderDto));
        }
        //[HttpGet("v{version:apiVersion}/Orders", Title = "GetAllOrdersRoute")]
        public async Task <IActionResult> GetOrders([FromHeader(Name = "x-correlationToken")] string correlationToken)
        {
            _telemetryClient.TrackEvent(
                $"Publishing EmptyBasketEvent from CheckOutEventHandler in Ordering.API for Request {correlationToken} ");



            Guard.ForNullOrEmpty(correlationToken, "correlationToken");

            var orders = await _orderQueries.GetOrders(correlationToken);

            if (orders == null || orders.Count < 1)
            {
                return(BadRequest("Orders do not exist"));
            }

            return(new ObjectResult(RestMapper.MapToOrdersDto(orders)));
        }
        public async Task <IActionResult> GetOrders()
        {
            var orders = await _orderQueries.GetOrders();

            return(Ok(orders));
        }
示例#7
0
        public async Task <PagedResult <OrderSummeryViewModel> > Handle(GetAllOrdersQuery request, CancellationToken cancellationToken)
        {
            PagedResult <OrderSummeryViewModel> List = await OrderQueries.GetOrders(request.pageSize, request.pageIndex);

            return(List);
        }