i need to insert items that are not in db. so i'm trying to run the following (which doesn't work):
foreach(var rep in model.Reps.Where(x => x.Value !=
this.dicti开发者_Go百科onaryItemRepository.List().Select(y => y.Value)))
where model.Reps is:
public ICollection<DictionaryItemBrand> Reps { get; set; }
returned from model binder
I'm trying to do a foreach loop -> select all items from model.Reps that do NOT yet exist in repository.
how can i do it? thanks
This should be it.
var notInRepo = from rep in model.Reps
where (!this.dictionaryItemRepository.Contains(rep.Value))
select rep.Value;
精彩评论