public IActionResult Get(bool includeReviews = false) { try { var companies = _companyRepository.GetAll(); var dtos = new List <CompanyDto>(); CompanyToDtoMapper.Map(companies, dtos, includeReviews); return(Ok(dtos)); } catch (Exception ex) { Log.Error(ex, $"unhandled exception"); return(StatusCode(500, ex)); } }
public IActionResult Get(int id, bool includeReviews = true) { try { var company = _companyRepository.GetById(id); if (company == null) { return(NotFound()); } var dto = new CompanyDto(); CompanyToDtoMapper.Map(company, dto, includeReviews); return(Ok(dto)); } catch (Exception ex) { Log.Error(ex, $"unhandled exception"); return(StatusCode(500, ex)); } }