fixed user update issue
This commit is contained in:
parent
2a73324ff7
commit
6bdbcb8e57
@ -205,18 +205,12 @@ namespace DamageAssesment.Api.UsersAccess.Providers
|
|||||||
|
|
||||||
if (_user != null)
|
if (_user != null)
|
||||||
{
|
{
|
||||||
int count = userAccessDbContext.Users.Where(u => u.Id != user.Id).Count();
|
Db.User vUsers = mapper.Map<Models.User, Db.User>(user);
|
||||||
if (count == 0)
|
vUsers.UpdateDate = DateTime.Now;
|
||||||
{
|
userAccessDbContext.Users.Update(vUsers);
|
||||||
await userAccessDbContext.SaveChangesAsync();
|
userAccessDbContext.SaveChanges();
|
||||||
logger?.LogInformation($"Employee Id: {user.EmployeeId} updated successfuly");
|
user.Id = Id;
|
||||||
return (true, mapper.Map<Db.User, Models.User>(_user), $"Employee Id: {_user.EmployeeId} updated successfuly");
|
return (true, user, "Successful");
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
logger?.LogInformation($"Employee Id: {user.EmployeeId} is already exist");
|
|
||||||
return (false, null, $"Employee Id: {user.EmployeeId} is already exist");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user