예제 #1
0
 public ProductValidator(IDestinationQuery desQuery)
 {
     RuleSet(AiringValidationRuleSet.PostAiring.ToString(), () =>
     {
         // Verify that product has destination
         RuleFor(c => c)
         .Must(c =>
         {
             return(!desQuery
                    .GetByProductIds(new List <Guid> {
                 c.ExternalId
             })
                    .IsNullOrEmpty());
         })
         .WithMessage("Product {0} doesn't have a destination. Products require one or more destination before content can be fulfilled. Please contact ODT team - [email protected]", c => c.ExternalId);
     });
 }
예제 #2
0
 /// <summary>
 /// Gets products by product ids.
 /// </summary>
 /// <param name="productIds">The product ids.</param>
 /// <returns></returns>
 public List <BLModel.Destination> GetByProductIds(IList <Guid> productIds)
 {
     return(destinationHelper.GetByProductIds(productIds)
            .ToList <DLModel.Destination>()
            .ToViewModel <List <DLModel.Destination>, List <BLModel.Destination> >());
 }