public List <Delivery> GetDeliveries()
        {
            List <Delivery> deliveryList = new List <Delivery>();

            try
            {
                deliveryRepository.GetDeliveries().ForEach(f =>
                {
                    var deliveryData = MapperConfig.Mapper.Map <Delivery>(f);
                    if (deliveryData.DeliveryStatus > 0)
                    {
                        deliveryData.DeliveryStatusDesc = ResourceService.Resource.GetCaption(((DeliveryStatus)deliveryData.DeliveryStatus).ToString());
                    }
                    if (deliveryData.RouteId != null)
                    {
                        deliveryData.RouteName = masterRepository.GetRoute(deliveryData.RouteId.Value)?.RouteName;
                    }
                });
            }
            catch (Exception ex)
            {
                logger.LogError(ex, ex.Message);
            }

            return(deliveryList);
        }
예제 #2
0
 public IEnumerable <Delivery> GetDeliveries()
 {
     if (!CurrentUser.HasRole(UserRole.Member))
     {
         throw new DomainValidationException(Messages.InsufficientSecurityClearance, "CurrentUser");
     }
     return(_deliveryRepository.GetDeliveries());
 }