added additional fields in user method
This commit is contained in:
parent
c014739fc0
commit
ff4e8de3f3
@ -88,14 +88,28 @@ namespace DamageAssesment.Api.UsersAccess.Providers
|
||||
{
|
||||
var employee = employees.SingleOrDefault(a=>a.Id==user.EmployeeId);
|
||||
var role = roles.SingleOrDefault(s => s.Id == user.RoleId);
|
||||
|
||||
string FirstName = null, LastName = null, EmployeeName = null;
|
||||
if (employee != null)
|
||||
{
|
||||
string[] names = employee.Name.Split(' ');
|
||||
EmployeeName = employee.Name;
|
||||
FirstName = names[0];
|
||||
LastName = EmployeeName.Replace(FirstName+" ","");
|
||||
}
|
||||
userslist.Add(new
|
||||
{
|
||||
Id = user.Id,
|
||||
EmployeeId = user.EmployeeId,
|
||||
EmployeeCode = user.EmployeeCode,
|
||||
EmployeeName = (employee != null) ? employee.Name : null,
|
||||
FirstName = FirstName,
|
||||
LastName = LastName,
|
||||
EmployeeName = EmployeeName,
|
||||
RoleId = user.RoleId,
|
||||
RoleName = (role != null) ? role.Name : null
|
||||
RoleName = (role != null) ? role.Name : null,
|
||||
IsActive = user.IsActive,
|
||||
CreatedDate = user.CreateDate,
|
||||
UpdatedDate = user.UpdateDate
|
||||
});
|
||||
}
|
||||
logger?.LogInformation($"{users.Count} Items(s) found");
|
||||
@ -121,14 +135,27 @@ namespace DamageAssesment.Api.UsersAccess.Providers
|
||||
{
|
||||
var employee = await employeeServiceProvider.getEmployeeAsync(user.EmployeeId,GetToken());
|
||||
var role = await userAccessDbContext.Roles.SingleOrDefaultAsync(s => s.Id == user.RoleId);
|
||||
string FirstName = null, LastName = null, EmployeeName = null;
|
||||
if(employee != null)
|
||||
{
|
||||
string[] names = employee.Name.Split(' ');
|
||||
EmployeeName = employee.Name;
|
||||
FirstName = names[0];
|
||||
LastName = EmployeeName.Replace(FirstName + " ", "");
|
||||
}
|
||||
var data = new
|
||||
{
|
||||
Id = user.Id,
|
||||
EmployeeId = user.EmployeeId,
|
||||
EmployeeCode=user.EmployeeCode,
|
||||
EmployeeName = (employee != null) ? employee.Name : null,
|
||||
FirstName= FirstName,
|
||||
LastName= LastName,
|
||||
EmployeeName = EmployeeName,
|
||||
RoleId = user.RoleId,
|
||||
RoleName = (role!=null)?role.Name:null
|
||||
RoleName = (role!=null)?role.Name:null,
|
||||
IsActive=user.IsActive,
|
||||
CreatedDate=user.CreateDate,
|
||||
UpdatedDate=user.UpdateDate
|
||||
};
|
||||
logger?.LogInformation($"User Id: {Id} found");
|
||||
var result = mapper.Map<Db.User, Models.User>(user);
|
||||
|
Loading…
Reference in New Issue
Block a user