I have following class structure
public class OfferModelCollection
{
List<OfferModel> offers = new List<OfferModel>();
}
public class OfferModel
{
public int ID { get; set; }
public ProviderModel Provider { get; set; }
public ProviderType ProviderType { get; set; } //Enum
}
public class ProviderModel : BaseModel, IIdentity
{
public string ProviderCode { get; set; }
public string ProviderName { get; set; }
}
I am now trying to update ProviderType
of those offers
whose Provider.ProviderCode matches to some string value. How can I achieve it in LINQ?
Something like this:
offersVM.Offers.Where(x=>x.Provider.ProviderCode.Contains("p10"))).ProviderType = ProviderType.Default;