Esempio n. 1
0
        public Response <string> RegisterDiscount(string orderId, IDiscountService discountService)
        {
            try
            {
                var order = FindOrderById(orderId);
            }
            catch (Exception)
            {
                return(Response <string> .Error($"Order with id: {orderId} not found!"));
            }

            try
            {
                var discountServiceId = orderRepository.AddDiscountToOrder(orderId, discountService);
                return(Response <string> .Success($"Discount with id: {discountServiceId} added to order."));
            }
            catch (Exception ex)
            {
                return(Response <string> .Error(ex.Message));
            }
        }