forked from ddrilling/AsbCloudServer
Правки по ревью
This commit is contained in:
parent
447478836b
commit
2925e56876
@ -30,7 +30,18 @@ namespace AsbCloudInfrastructure.Services
|
||||
{
|
||||
Caption = c.Caption,
|
||||
Id = c.Id,
|
||||
Users = c.Users.Select(user => Convert(user, wellId))
|
||||
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)
|
||||
})
|
||||
});
|
||||
|
||||
var entities = await query.AsNoTracking()
|
||||
@ -58,16 +69,11 @@ namespace AsbCloudInfrastructure.Services
|
||||
var items = db.RelationContactsWells
|
||||
.Where(x => x.IdWell == idWell && x.User.Company.IdCompanyType == contactTypeId);
|
||||
|
||||
var wellContacts = new List<RelationContactWell>();
|
||||
foreach (var userId in userIds)
|
||||
{
|
||||
var wellContact = new RelationContactWell()
|
||||
var wellContacts = userIds.Select(userId => new RelationContactWell()
|
||||
{
|
||||
IdWell = idWell,
|
||||
IdUser = userId,
|
||||
};
|
||||
wellContacts.Add(wellContact);
|
||||
}
|
||||
});
|
||||
|
||||
db.RelationContactsWells.RemoveRange(items);
|
||||
db.RelationContactsWells.AddRange(wellContacts);
|
||||
|
Loading…
Reference in New Issue
Block a user