Пример #1
0
        public void GetOrderLineTestFound()
        {
            orderService.AddOrder(mockFactory.CreateOrder());

            int Id = context.OrderLines.First().Id;

            OrderLine orderLine = orderLineService.GetOrderLine(Id);

            Assert.NotNull(orderLine);
        }
Пример #2
0
        public IActionResult OnGet(int orderlineId)
        {
            this.orderlineid = orderlineId;
            OrderLines       = orderLineService.GetOrderLine(orderlineId);
            Orders           = orderService.GetOrder(orderlineId);

            if (OrderLines != null)
            {
                return(Page());
            }
            else
            {
                return(NotFound());
            }
        }
Пример #3
0
        public IActionResult GetOrderLineByOrderLineNumber(int id)
        {
            try
            {
                OrderLine orderLine = orderLineService.GetOrderLine(id);

                if (orderLine == null)
                {
                    return(NotFound($"The orderline was not found. Requested orderline id = {id}."));
                }

                return(Ok(mapper.MapModelToDto(orderLine)));
            }
            catch (Exception e)
            {
                string message = $"Getting the orderline failed. Requested orderline id = {id}.";
                logger.LogError($"{message}\r\n{e.Message}", e);
                return(BadRequest(message));
            }
        }