Merged PR 91: added additional fields in user method
added additional fields in user method
This commit is contained in:
commit
dd5351665e
@ -88,14 +88,28 @@ namespace DamageAssesment.Api.UsersAccess.Providers
|
|||||||
{
|
{
|
||||||
var employee = employees.SingleOrDefault(a=>a.Id==user.EmployeeId);
|
var employee = employees.SingleOrDefault(a=>a.Id==user.EmployeeId);
|
||||||
var role = roles.SingleOrDefault(s => s.Id == user.RoleId);
|
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
|
userslist.Add(new
|
||||||
{
|
{
|
||||||
Id = user.Id,
|
Id = user.Id,
|
||||||
EmployeeId = user.EmployeeId,
|
EmployeeId = user.EmployeeId,
|
||||||
EmployeeCode = user.EmployeeCode,
|
EmployeeCode = user.EmployeeCode,
|
||||||
EmployeeName = (employee != null) ? employee.Name : null,
|
FirstName = FirstName,
|
||||||
|
LastName = LastName,
|
||||||
|
EmployeeName = EmployeeName,
|
||||||
RoleId = user.RoleId,
|
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");
|
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 employee = await employeeServiceProvider.getEmployeeAsync(user.EmployeeId,GetToken());
|
||||||
var role = await userAccessDbContext.Roles.SingleOrDefaultAsync(s => s.Id == user.RoleId);
|
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
|
var data = new
|
||||||
{
|
{
|
||||||
Id = user.Id,
|
Id = user.Id,
|
||||||
EmployeeId = user.EmployeeId,
|
EmployeeId = user.EmployeeId,
|
||||||
EmployeeCode=user.EmployeeCode,
|
EmployeeCode=user.EmployeeCode,
|
||||||
EmployeeName = (employee != null) ? employee.Name : null,
|
FirstName= FirstName,
|
||||||
|
LastName= LastName,
|
||||||
|
EmployeeName = EmployeeName,
|
||||||
RoleId = user.RoleId,
|
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");
|
logger?.LogInformation($"User Id: {Id} found");
|
||||||
var result = mapper.Map<Db.User, Models.User>(user);
|
var result = mapper.Map<Db.User, Models.User>(user);
|
||||||
|
Loading…
Reference in New Issue
Block a user