Доработка по модалке контактов: в список контактов должны попадать только активные пользователи

This commit is contained in:
Olga Nemt 2023-08-21 15:51:51 +05:00
parent 23fd77eb9d
commit 2ee10e8e70

View File

@ -29,18 +29,21 @@ namespace AsbCloudInfrastructure.Services
{
Caption = c.Caption,
Id = c.Id,
Users = c.Users.Select(u => new UserContactDto()
{
Id = u.Id,
Name = u.Name,
Patronymic = u.Patronymic,
Surname = u.Surname,
Company = u.Company.Adapt<CompanyDto>(),
Email = u.Email,
Phone = u.Phone,
Position = u.Position,
IsContact = u.RelationContactsWells.Any(rel => rel.IdWell == wellId)
})
Users = c.Users
.Where(u => u.IdState == 1)
.OrderBy(u => u.Surname)
.Select(u => new UserContactDto()
{
Id = u.Id,
Name = u.Name,
Patronymic = u.Patronymic,
Surname = u.Surname,
Company = u.Company.Adapt<CompanyDto>(),
Email = u.Email,
Phone = u.Phone,
Position = u.Position,
IsContact = u.RelationContactsWells.Any(rel => rel.IdWell == wellId)
})
});
var entities = await query.AsNoTracking()