public ActionResult <IEnumerable <ProductReadDto> > GetAllProduct() { // if (!_apiKeyRepo.Authenticated("1234567891234567")) // { // return StatusCode(StatusCodes.Status401Unauthorized, "The Api Key provided is not valid"); // } var products = _repository.GetAllProducts(); try { return(Ok(_mapper.Map <IEnumerable <ProductReadDto> >(products))); } catch { return(StatusCode(StatusCodes.Status500InternalServerError, "Fatal Error")); } }