Created an endpoint to fetch list of all contact category in that tenant
This commit is contained in:
parent
84cfdc29b2
commit
c2223e4029
@ -676,7 +676,8 @@ namespace Marco.Pms.Services.Controllers
|
||||
[HttpGet("contact-categories")]
|
||||
public async Task<IActionResult> GetContactCategoryMasterList()
|
||||
{
|
||||
return Ok();
|
||||
var response = await _masterHelper.GetContactCategoriesList();
|
||||
return Ok(response);
|
||||
}
|
||||
|
||||
[HttpGet("contact-category/{id})")]
|
||||
@ -715,7 +716,7 @@ namespace Marco.Pms.Services.Controllers
|
||||
return Ok();
|
||||
}
|
||||
|
||||
// -------------------------------- Contact Category --------------------------------
|
||||
// -------------------------------- Contact Tag --------------------------------
|
||||
|
||||
[HttpGet("contact-tags")]
|
||||
public async Task<IActionResult> GetContactTagMasterList()
|
||||
|
@ -48,6 +48,22 @@ namespace Marco.Pms.Services.Helpers
|
||||
return ApiResponse<object>.ErrorResponse("User Send empty Payload", "User Send empty Payload", 400);
|
||||
}
|
||||
|
||||
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 --------------------------------
|
||||
// -------------------------------- Bucket --------------------------------
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user