There are two different objects.
UserDto.cs
public Guid GradeId { get; set; }
public bool isActiveUser { get; set; }
User.cs
public Guid GradeId { get; set; }
public bool isActiveUser { get; set; }
public Guid ParentUserId { get; set; }
Both object have some data and I am trying to get intersection and update only those objects in DB.
var toBeUpdated = userDtos
.Intersect(mapper.Map<List<User>>(users)) //USING AutoMapper here
.ToList();
foreach (var item in toBeUpdated)
{
userRepository.Update(item);
}
These objects must be intersected with GradeId. With the code I wrote, I am not getting any objects by that query. Example :
users :
GradeId - 1 isActive - false
userDtos :
GradId - 1 isActive - true
I want to be able to intersect these two collections by GradeId and set isActive to true(as in DTO)