public HttpResponseMessage Put([FromBody] OrderBatchUpdateRequest request)
        {
            var orderBatch = _orderBatchService.GetById(request.Id);

            if (orderBatch == null)
            {
                return(NotFound(_resourceManager.GetString("Common.DataNotFound")));
            }

            try
            {
                if (request.Type == ApproveAction)
                {
                    _orderBatchService.Approve(_workContext.User, orderBatch);
                }
                else if (request.Type == RejectAction)
                {
                    _orderBatchService.Reject(_workContext.User, orderBatch, request.Reason);
                }
            }
            catch (Exception ex)
            {
                _logger.WriteLog("Failed to update order.", ex);
                return(Request.CreateErrorResponse(
                           HttpStatusCode.BadRequest,
                           new HttpError(_resourceManager.GetString("OrderBatch.FailedToUpdate"))));
            }

            return(Request.CreateResponse());
        }
        public HttpResponseMessage PutAll([FromBody] OrderBatchUpdateRequest request)
        {
            IList <string> failedLocations = null;

            try
            {
                if (request.Type == ApproveAction)
                {
                    _orderBatchService.ApproveAll(_workContext.User, request.OrderType, out failedLocations);
                }
                else if (request.Type == RejectAction)
                {
                    _orderBatchService.RejectAll(_workContext.User, request.OrderType, request.Reason, out failedLocations);
                }
            }
            catch (Exception ex)
            {
                _logger.WriteLog("Failed to update order.", ex);
                return(Request.CreateErrorResponse(
                           HttpStatusCode.BadRequest,
                           new HttpError(_resourceManager.GetString("OrderBatch.FailedToUpdate"))));
            }

            return(Request.CreateResponse(failedLocations));
        }