From 11ac997ca7761f9d68b43ee377f864f8379dcbd5 Mon Sep 17 00:00:00 2001 From: Stanislav Mykhailenko Date: Tue, 30 May 2023 20:54:17 +0300 Subject: [PATCH] Update CheckAdminAsync --- NG_2023_Kanban.BusinessLayer/Service/UserService.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/NG_2023_Kanban.BusinessLayer/Service/UserService.cs b/NG_2023_Kanban.BusinessLayer/Service/UserService.cs index 88ddb1f..c898f96 100644 --- a/NG_2023_Kanban.BusinessLayer/Service/UserService.cs +++ b/NG_2023_Kanban.BusinessLayer/Service/UserService.cs @@ -58,16 +58,8 @@ namespace NG_2023_Kanban.BusinessLayer.Services public async Task CheckAdminAsync(int id) { var user = await GetAsync(id); - - Console.WriteLine(user.Roles.Count); - foreach (RoleModel role in user.Roles) - { - if (role.Name == "Administrator") - { - return true; - } - } - return false; + + return user.Roles.Any(role => role.Name == "Administrator"); } } }