Ejemplo n.º 1
0
 public virtual IActionResult SubmitParcel([FromBody] Parcel body)
 {
     try
     {
         logger.LogInformation($"Submitting new parcel {body}");
         Business.Parcel p          = this.mapper.Map <Business.Parcel>(body);
         string          trackingId = this.senderLogic.SubmitNewParcel(p);
         return(StatusCode(200, trackingId));
     }
     catch (BusinessLayerException e)
     {
         throw new ServiceLayerException("BL Exception", e);
     }
 }
Ejemplo n.º 2
0
 public virtual IActionResult TransitionParcel([FromBody] Parcel body, [FromRoute][Required][RegularExpression("^[A-Z0-9]{9}$")] string trackingId)
 {
     try
     {
         logger.LogInformation($"Transfering Parcel {trackingId}");
         Business.Parcel p = mapper.Map <Business.Parcel>(body);
         this.logisticsPartnerLogic.TransferParcel(trackingId, p);
         return(StatusCode(200));
     }
     catch (BusinessLayerException e)
     {
         throw new ServiceLayerException("BL Exception", e);
     }
 }
Ejemplo n.º 3
0
 public virtual IActionResult TrackParcel([FromRoute][Required][RegularExpression("^[A-Z0-9]{9}$")] string trackingId)
 {
     try
     {
         logger.LogInformation($"Tracking Parcel {trackingId}");
         Business.Parcel     parcel = this.receipientLogic.TrackParcel(trackingId);
         TrackingInformation p      = mapper.Map <TrackingInformation>(parcel);
         return(StatusCode(200, p));
     }
     catch (BusinessLayerException e)
     {
         throw new ServiceLayerException("BL Exception", e);
     }
 }