Пример #1
0
 public OfferAttributeApiObject OfferAttributeApiObject(string id, string value)
 {
     OfferAttributeApiObject attribute = new OfferAttributeApiObject();
     attribute.Name = id;
     attribute.Value = value;
     return attribute;
 }
 public static void RespondentAttributeToOfferApiObject(List<OfferObject> offers)
 {
     List<OfferAttributeApiObject> convertedAttributes;
     foreach (var offer in offers)
     {
         convertedAttributes = new List<OfferAttributeApiObject>();
         if (offer.RespondentAttributes != null)
         {
             foreach (var respondent in offer.RespondentAttributes)
             {
                 if (attributes.Exists(i => i.Id == respondent.Ident))
                 {
                     if ((bool)attributes.Find(i => i.Id == respondent.Ident).AttributeSetting.Publish)
                     {
                         OfferAttributeApiObject oaao = new OfferAttributeApiObject();
                         oaao.Name = respondent.Ident;
                         oaao.Value = respondent.Values;
                         convertedAttributes.Add(oaao);
                     }
                 }
             }
             IOfferAttributeRepository.Setup(i => i.GetOfferAttributes(offer.Id)).Returns(convertedAttributes);
         }
     }
 }