Ejemplo n.º 1
0
 public virtual IActionResult SubmitParcel([FromBody] Parcel parcel)
 {
     try
     {
         var           BLmapped      = _mapper.Map <BL.Parcel>(parcel);
         NewParcelInfo newParcelInfo = _senderLogic.SubmitParcelIntoBL(BLmapped);
         return(StatusCode(200, newParcelInfo));
     }
     catch (BL.BLException exc)
     {
         return(handleReturn(System.Reflection.MethodBase.GetCurrentMethod().Name, exc));
     }
     catch (Exception exc)
     {
         return(handleReturn(System.Reflection.MethodBase.GetCurrentMethod().Name, exc));
     }
 }
Ejemplo n.º 2
0
        public virtual IActionResult TransitionParcel([FromBody] Parcel parcel, [FromRoute][Required][RegularExpression("^[A-Z0-9]{9}$")] string trackingId)
        {
            try
            {
                var BLmapped = _mapper.Map <BL.Parcel>(parcel);
                BLmapped.TrackingId = trackingId;
                NewParcelInfo newParcelInfo = _senderLogic.SubmitParcelIntoBL(BLmapped);
                //If the trackingId already exists we generate a new one and save the old one into the db
                _recLogic.TransferParcelPartner(newParcelInfo.TrackingId, trackingId);

                return(StatusCode(200, newParcelInfo));
            }
            catch (BL.BLException exc)
            {
                return(handleReturn(System.Reflection.MethodBase.GetCurrentMethod().Name, exc));
            }
            catch (Exception exc)
            {
                return(handleReturn(System.Reflection.MethodBase.GetCurrentMethod().Name, exc));
            }
        }