public void UpdateSumOrder(int orderId)
        {
            var order = _orderRepository.GetOrderById(orderId);

            order.SumDollar = _orderDetailRepository.GetAllOrderDetails().Where(o => o.OrderId == order.OrderId).Select(d => d.Count * d.PriceInDollar).Sum();
            order.SumEuro   = _orderDetailRepository.GetAllOrderDetails().Where(o => o.OrderId == order.OrderId).Select(d => d.Count * d.PriceInEuro).Sum();
            _orderRepository.UpdateOrder(order);
            _orderRepository.Save();
        }
Exemple #2
0
        public JsonResult GetOrderDetails(int id, [DataSourceRequest] DataSourceRequest dataSourceRequest)
        {
            IQueryable <OrderDetail> orderDetails = _orderDetailRepository.GetAllOrderDetails().Where(od => od.OrderId == id);

            return(Json(orderDetails.ToDataSourceResult(dataSourceRequest, Mapper.Map <OrderDetailViewModel>), JsonRequestBehavior.AllowGet));
        }