Created an endpoint to fetch list of all contact category in that tenant
This commit is contained in:
parent
aa60551524
commit
53c210915a
@ -112,6 +112,22 @@ namespace Marco.Pms.Services.Helpers
|
||||
return ApiResponse<object>.SuccessResponse(new { }, "Category deleted successfully", 200);
|
||||
}
|
||||
|
||||
public async Task<ApiResponse<object>> GetContactCategoriesList()
|
||||
{
|
||||
Guid tenantId = _userHelper.GetTenantId();
|
||||
var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync();
|
||||
|
||||
var categoryList = await _context.ContactCategoryMasters.Where(c => c.TenantId == tenantId).ToListAsync();
|
||||
List<ContactCategoryVM> contactCategories = new List<ContactCategoryVM>();
|
||||
foreach (var category in categoryList)
|
||||
{
|
||||
ContactCategoryVM categoryVM = category.ToContactCategoryVMFromContactCategoryMaster();
|
||||
contactCategories.Add(categoryVM);
|
||||
}
|
||||
_logger.LogInfo("{count} contact categoires are fetched by Employee with ID {LoggedInEmployeeId}", contactCategories.Count, LoggedInEmployee.Id);
|
||||
return ApiResponse<object>.SuccessResponse(contactCategories, System.String.Format("{0} contact categories fetched successfully", contactCategories.Count), 200);
|
||||
}
|
||||
|
||||
// -------------------------------- Contact Tag --------------------------------
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user