public ActionResult MoveOrderItemsToOriginalOrder(int packageId)
 {
     var request = new MoveOrderItemsToOriginalOrderRequest { PackageId = packageId };
     var response = this.itemsService.MoveOrderItemsToOriginalOrder(request);
     var jsonNetResult = new JsonNetResult
     {
         Formatting = (Formatting)Newtonsoft.Json.Formatting.Indented,
         Data = response.ConvertToPackageItemViewModelCollection()
     };
     return jsonNetResult;
 }
Exemple #2
0
 /// <summary>
 /// The move order items to original order.
 /// </summary>
 /// <param name="request">
 /// The request.
 /// </param>
 /// <returns>
 /// The <see cref="MoveOrderItemsToOriginalOrderResponse"/>.
 /// </returns>
 public MoveOrderItemsToOriginalOrderResponse MoveOrderItemsToOriginalOrder(MoveOrderItemsToOriginalOrderRequest request)
 {
     try
     {
         var items = this.itemsRepository.GetPackageItems(request.PackageId);
         items.ForEach(i => this.itemsRepository.DetachItemFromPackage(request.PackageId, i.Id));
         var result = items.ConvertToMoveOrderItemsToOriginalOrderResponse();
         result.PackageId = request.PackageId;
         result.MessageType = MessageType.Success;
         result.Message = string.Format(
             CommonResources.PackageItemsSuccessfullyMovedBackToOriginalOrder, items.First().OrderId);
         return result;
     }
     catch (Exception ex)
     {
         this.Logger.Error("Error while moving order items back to original order", ex);
         return new MoveOrderItemsToOriginalOrderResponse { MessageType = MessageType.Error, Message = CommonResources.MoveOrderItemsToOriginalOrderError };
     }
 }