Api: people. Fixed "Sequence contains no elements" error while saving empty contacts list

This commit is contained in:
Andrey Savihin 2019-12-27 13:19:35 +03:00
parent ddb222fd86
commit 48e56d462a

View File

@ -1384,7 +1384,8 @@ namespace ASC.Employee.Core.Controllers
PermissionContext.DemandPermissions(new UserSecurityProvider(user.ID), Constants.Action_EditUser);
if (contacts == null) return;
user.Contacts = contacts.Select(r => $"{r.Type}|{r.Value}").Aggregate((a, b) => $"{a}|{b}");
var values = contacts.Where(r => !string.IsNullOrEmpty(r.Value)).Select(r => $"{r.Type}|{r.Value}");
user.Contacts = string.Join('|', values);
}
private void DeleteContacts(IEnumerable<Contact> contacts, UserInfo user)