コード例 #1
0
        public async Task <IActionResult> GetAsync(int id)
        {
            try
            {
                CustomerDto customer = await _customerService.GetByIdAsync(id);

                return(Ok(new ApiResponse <CustomerDto>(customer)));
            }
            catch (EntityNotFoundException ex)
            {
                return(NotFound(new ApiResponse <string>(ex.Message)));
            }
            catch (Exception ex)
            {
                return(Ok(new ApiResponse <string>(ex.Message)));
            }
        }