コード例 #1
0
        public ActionResult <ApiResponse <List <ReasonDto> > > GetAll()
        {
            var response = new ApiResponse <List <ReasonDto> >();

            try
            {
                response.Result = _mapper.Map <List <ReasonDto> >(_reasonRepository.GetAll());
            }
            catch (Exception ex)
            {
                response.Result  = null;
                response.Success = false;
                response.Message = "Internal server error";
                _logger.LogError($"Something went wrong: { ex.ToString() }");
                return(StatusCode(500, response));
            }

            return(Ok(response));
        }
コード例 #2
0
 public IEnumerable <Reason> GetAll()
 {
     return(reasonRepository.GetAll(false));
 }