added api to get list of contact tag
This commit is contained in:
parent
ecc8c6d801
commit
967488e9c1
@ -721,7 +721,8 @@ namespace Marco.Pms.Services.Controllers
|
||||
[HttpGet("contact-tags")]
|
||||
public async Task<IActionResult> GetContactTagMasterList()
|
||||
{
|
||||
return Ok();
|
||||
var response = await _masterHelper.GetContactTags();
|
||||
return Ok(response);
|
||||
}
|
||||
|
||||
[HttpGet("contact-tag/{id})")]
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using System.Linq;
|
||||
using Marco.Pms.DataAccess.Data;
|
||||
using Marco.Pms.Model.Directory;
|
||||
using Marco.Pms.Model.Dtos.Master;
|
||||
using Marco.Pms.Model.Mapper;
|
||||
@ -65,6 +66,23 @@ namespace Marco.Pms.Services.Helpers
|
||||
}
|
||||
|
||||
// -------------------------------- Contact Tag --------------------------------
|
||||
|
||||
|
||||
public async Task<ApiResponse<Object>> GetContactTags()
|
||||
{
|
||||
Guid tenantId = _userHelper.GetTenantId();
|
||||
|
||||
var LoggedInEmployee = await _userHelper.GetCurrentEmployeeAsync();
|
||||
|
||||
var taglist = await _context.ContactTagMasters.Where(t => t.TenantId == tenantId).ToListAsync();
|
||||
List<ContactTagVM> contactTags = new List<ContactTagVM>();
|
||||
foreach (var tag in taglist) {
|
||||
ContactTagVM tagVm = tag.ToContactTagVMFromContactTagMaster();
|
||||
contactTags.Add(tagVm);
|
||||
}
|
||||
_logger.LogInfo("{count} contact Tags are fetched by Employee with ID {LoggedInEmployeeId}", contactTags.Count, LoggedInEmployee.Id);
|
||||
return ApiResponse<object>.SuccessResponse(contactTags, System.String.Format("{0} contact tags fetched successfully", contactTags.Count),200);
|
||||
}
|
||||
// -------------------------------- Bucket --------------------------------
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user