Beispiel #1
0
 public AddOrderResponse AddOrder(AddOrderRequest request)
 {
     return new AddOrderResponse
                {
                    OrderID = _customerManager.AddOrderToCustomer(request)
                };
 }
Beispiel #2
0
        public int AddOrderToCustomer(AddOrderRequest request)
        {
            Order order = null;

            AOPify.AOPify
                .Let
                .RegisterLogger(Log.It.For(this).Use(_logger))
                .Log(string.Format("START :Customer ADDORDER op started Type: {0}, Method:{1}", GetType().Name, MethodBase.GetCurrentMethod().Name),
                        string.Format("END :Customer ADDORDER op ended Type: {0}, Method:{1} , CustomerID :{2}", GetType().Name, MethodBase.GetCurrentMethod().Name, request.CustomerID))
                .Run(() =>
                         {
                             Customer customer = _customerRepository.Find(request.CustomerID);
                             order = request.OrderDto.ToOrder();
                             if (customer != null) customer.Orders.Add(order);
                             SaveChanges();
                         });

            return order.OrderId;
        }