示例#1
0
        public async Task <IActionResult> GetById(int id)
        {
            var result = await _reasonService.GetById(id);

            var reasons = _mapper.Map <ReasonDTO>(result);

            return(Ok(reasons));
        }
示例#2
0
        public IActionResult GetById(int id)
        {
            try
            {
                var entity = _service.GetById(id);

                return(Ok(_mapper.Map <BL.Reason, Reason>(entity)));
            }
            catch (Exception ex)
            {
                return(BadRequest($"{ex.Message}"));
            }
        }