Exemplo n.º 1
0
 public ActionResult MoveOrderItemToNewPackage(int itemId, int packageId)
 {
     var request = new MoveOrderItemToExistingPackageRequest { ItemId = itemId, PackageId = packageId };
     var response = this.itemsService.MoveOrderItemsToExistingPackage(request);
     var jsonNetResult = new JsonNetResult
     {
         Formatting = (Formatting)Newtonsoft.Json.Formatting.Indented,
         Data = response.ConvertToMoveOrderItemToExistingPackageViewModel()
     };
     return jsonNetResult;
 }
Exemplo n.º 2
0
 /// <summary>
 /// The move order items to existing package.
 /// </summary>
 /// <param name="request">
 /// The request.
 /// </param>
 /// <returns>
 /// The <see cref="MoveOrderItemToExistingPackageResponse"/>.
 /// </returns>
 public MoveOrderItemToExistingPackageResponse MoveOrderItemsToExistingPackage(MoveOrderItemToExistingPackageRequest request)
 {
     try
     {
         this.itemsRepository.AttachItemToPackage(request.PackageId, request.ItemId);
         var item = this.itemsRepository.GetItemById(request.ItemId);
         var result = item.ConvertToMoveOrderItemToExistingPackageResponse();
         result.PackageId = request.PackageId;
         result.OrderId = item.OrderId;
         result.MessageType = MessageType.Success;
         result.Message = string.Format(CommonResources.OrderItemSuccessfullyMoved, request.PackageId);
         return result;
     }
     catch (Exception ex)
     {
         this.Logger.Error("Error while moving order item to existing package", ex);
         return new MoveOrderItemToExistingPackageResponse { MessageType = MessageType.Error, Message = CommonResources.MoveOrderItemToExistingPackageError };
     }
 }