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