Esempio n. 1
0
        public ActionResult ChangePackageDispatchMethod(int packageId, int dispatchMethodId)
        {
            var request = new ChangePackageDeliveryMethodRequest { PackageId = packageId, DispatchMethodId = dispatchMethodId };
            var response = this.packagesService.ChangePackageDispatchMethod(request);

            var jsonNetResult = new JsonNetResult
            {
                Formatting = (Formatting)Newtonsoft.Json.Formatting.Indented,
                Data = new { response.Message, MessageType = response.MessageType.ToString() }
            };
            return jsonNetResult;
        }
Esempio n. 2
0
 /// <summary>
 /// The change package dispatch method.
 /// </summary>
 /// <param name="request">
 /// The request.
 /// </param>
 /// <returns>
 /// The <see cref="ChangePackageDeliveryMethodResponse"/>.
 /// </returns>
 public ChangePackageDeliveryMethodResponse ChangePackageDispatchMethod(ChangePackageDeliveryMethodRequest request)
 {
     try
     {
         var package = this.packageRepository.GetPackageById(request.PackageId);
         package.DispatchMethod = (DispatchMethod)Enum.Parse(typeof(DispatchMethod), request.DispatchMethodId.ToString(CultureInfo.InvariantCulture));
         this.packageRepository.UpdatePackage(package);
         return new ChangePackageDeliveryMethodResponse { MessageType = MessageType.Success, Message = string.Format(CommonResources.PackageDispatchMethodChanged, package.Id) };
     }
     catch (Exception ex)
     {
         this.Logger.Log(ex.Message);
         return new ChangePackageDeliveryMethodResponse { MessageType = MessageType.Error, Message = CommonResources.ChangePackageDispatchMethodError };
     }
 }