From d72fa803793c5d114c3eabb8fe2de04cd2042db1 Mon Sep 17 00:00:00 2001 From: Userok Date: Fri, 1 Nov 2024 10:52:05 +0300 Subject: [PATCH] --- Zurnal/Domain/UseCase/UserUseCase.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Zurnal/Domain/UseCase/UserUseCase.cs b/Zurnal/Domain/UseCase/UserUseCase.cs index 2860b17..3e34f6b 100644 --- a/Zurnal/Domain/UseCase/UserUseCase.cs +++ b/Zurnal/Domain/UseCase/UserUseCase.cs @@ -35,16 +35,11 @@ namespace Zurnal.Domain.UseCase { UserLocalEntity userLocalEntity = new UserLocalEntity { FIO = user.FIO, GroupID = id, Guid = user.Guid }; UserLocalEntity? result = _repositoryUserImpl.UpdateUser(userLocalEntity); - if (result == null) throw new Exception("Пользователь не обновлен."); - Group? group = GetAllGroups().FirstOrDefault(it => - { - bool v = it.Id == result.GroupID.ToString(); - return v; - }); - if (group == null) throw new Exception("Группа не обновлена."); - - return new User { FIO = user.FIO, Guid = user.Guid, Group = group }; - } + if (result == null) throw new Exception("User update failed."); + Group? group = GetAllGroups().FirstOrDefault(it => it.Id == result.GroupID.ToString()); + if (group == null) throw new Exception("Group not found."); + return new User { FIO = user.FIO, Guid = user.Guid, Group = group }; + } private List GetAllGroups() {