public async Task <IActionResult> GetAll() { try { var customers = await _customerRepo.GetAsync(); return(Ok(_mapper.Map <IEnumerable <Customer>, IEnumerable <CustomerDto> >(customers))); } catch (Exception e) { _log.LogError($"error getting customers {e}"); } return(BadRequest()); }
public async Task <Customer> GetCustomerDetailById(int id) { var customer = await _customerRepo.GetAsync(id); if (customer == null) { throw new NotFoundException("Customer Not found"); } return(customer); }