public async Task Test_GetShipmentById_Is_Ok()
 {
     try
     {
         ShipmentModel currentShipmentModel =
             await _shipmentService.Get(54, 1);
     }
     catch (Exception ex)
     {
         Assert.IsFalse(true);
     }
     Assert.IsTrue(true);
 }
        public async Task <ShipmentDetailModel?> Get(int id)
        {
            bool isReviewer = await _authorizationService.AuthorizeAsync(Policies.ReviewerPolicy);

            if (isReviewer)
            {
                return(await _service.Get <ShipmentDetailModel>(id));
            }
            CustomerItemModel?customer = await _customerService.GetCurrentCustomer <CustomerItemModel>();

            if (customer == null)
            {
                return(null);
            }
            return(await _service.Get <ShipmentDetailModel>(id, customer.Id, customer.ParentCustomerId));
        }
        public async Task <ShipmentModel> Get(int id, int customerId, string language)
        {
            var currentUser = await _authenticationService.GetUser(User.Identity.Name);

            if (currentUser.CustomerId != customerId)
            {
                throw new HttpResponseException(HttpStatusCode.InternalServerError, "Provided customer is not assigned to your account");
            }
            language.ConvertLocaleStringToServerLanguage();

            var shipment = await _shipmentService.Get(id, customerId);

            return(shipment);
        }
Exemple #4
0
 public ShipmentEntity Get(Guid shipmentId)
 {
     return(shipmentService.Get(shipmentId));
 }