From 6bdbcb8e57f2f807230e459078f131b7e51e25e6 Mon Sep 17 00:00:00 2001 From: Vijay Uppu <913468@dadeschools.net> Date: Sun, 17 Dec 2023 21:06:20 -0500 Subject: [PATCH] fixed user update issue --- .../Providers/UserAccessProvider.cs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/Providers/UserAccessProvider.cs b/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/Providers/UserAccessProvider.cs index 740e410..e7b11f9 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/Providers/UserAccessProvider.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/Providers/UserAccessProvider.cs @@ -205,18 +205,12 @@ namespace DamageAssesment.Api.UsersAccess.Providers if (_user != null) { - int count = userAccessDbContext.Users.Where(u => u.Id != user.Id).Count(); - if (count == 0) - { - await userAccessDbContext.SaveChangesAsync(); - logger?.LogInformation($"Employee Id: {user.EmployeeId} updated successfuly"); - return (true, mapper.Map(_user), $"Employee Id: {_user.EmployeeId} updated successfuly"); - } - else - { - logger?.LogInformation($"Employee Id: {user.EmployeeId} is already exist"); - return (false, null, $"Employee Id: {user.EmployeeId} is already exist"); - } + Db.User vUsers = mapper.Map(user); + vUsers.UpdateDate = DateTime.Now; + userAccessDbContext.Users.Update(vUsers); + userAccessDbContext.SaveChanges(); + user.Id = Id; + return (true, user, "Successful"); } else {