Exemplo n.º 1
0
        public ResponseDTO UpdateDCOrderStatus(DCOrderStatusDTO dCOrderStatusDTO)
        {
            ResponseDTO responseDTO = new ResponseDTO();
            var         dcOrder     = unitOfWork.DCOrderRepository.GetDCOrderByOrderId(dCOrderStatusDTO.DCOrderId);
            var         dc          = unitOfWork.DistributionCenterRepository.GetById(dcOrder.DCId);

            if (dcOrder == null)
            {
                throw new PlatformModuleException("DC Order Detail Not Found");
            }
            dcOrder.OrderStatusId = (int)dCOrderStatusDTO.OrderStatus;
            if (dCOrderStatusDTO.DeliveryExpectedDate != DateTime.MinValue)
            {
                dcOrder.DeliveryExpectedDate = dCOrderStatusDTO.DeliveryExpectedDate;
            }
            if (dCOrderStatusDTO.OrderStatus == OrderStatus.Received)
            {
                dcOrder.DeliveredDate = DateTimeHelper.GetISTDateTime();
                UpdateOrderPaymentDetailsForOrder(dc, dcOrder);
            }
            unitOfWork.DCOrderRepository.Update(dcOrder);
            unitOfWork.SaveChanges();
            responseDTO.Status  = true;
            responseDTO.Message = "DC Order Status is Updated";
            responseDTO.Data    = this.GetOrderDetailsByOrderId(dcOrder.DCOrderId);
            return(responseDTO);
        }
Exemplo n.º 2
0
        public IHttpActionResult UpdateDCOrderStatus(int id, [FromBody] DCOrderStatusDTO dCOrderStatusDTO)
        {
            try
            {
                dCOrderStatusDTO.DCOrderId = id;
                if (dCOrderStatusDTO == null)
                {
                    Ok(ResponseHelper.CreateResponseDTOForException("Argument Null"));
                }



                return(Ok(_dCOrderService.UpdateDCOrderStatus(dCOrderStatusDTO)));
            }
            catch (PlatformModuleException ex)
            {
                //Write Log Here
                return(Ok(ResponseHelper.CreateResponseDTOForException(ex.Message)));
            }
        }