public ActionResult <List <GetAllCustomers> > GetAllCustomers() { try { var result = _repository.GetAllCustomers(); IMapper mapper = EDeliveryProfile.GetAllCustomers(); return(mapper.Map <List <GetAllCustomers> >(result)); } catch (Exception ex) { _logger.LogError($"Failed to return all customers:{ex}"); return(BadRequest("Failed to return all customers.")); } }