public async Task <IActionResult> GetClientById(int id) { var client = await _clientService.GetClientById(id); if (client != null) { var resp = ClientMapper.MapUserDetailsToDto(client, _clientService); return(Ok(resp)); } return(Ok(client)); }
public async Task <IActionResult> SearchClient([FromQuery(Name = "searchStr")] string searchStr = "") { var searchResult = await _clientService.SearchClient(searchStr); if (searchResult != null && searchResult.Any()) { var resp = new List <ClientResponseDTO>(); foreach (var client in searchResult) { resp.Add(ClientMapper.MapUserDetailsToDto(client, _clientService)); } return(Ok(resp)); } return(Ok(searchResult)); }
public async Task <IActionResult> GetAllClients() { var clients = await _clientService.GetAllAsync(); if (clients != null && clients.Any()) { var resp = new List <ClientResponseDTO>(); foreach (var client in clients) { resp.Add(ClientMapper.MapUserDetailsToDto(client, _clientService)); } return(Ok(resp)); } return(Ok(clients)); }