public async Task <Result <HttpResponseWithElement <PermissionTypeDto> > > GetPermissionType(int permissionTypeId) { try { var exists = await _unitOfWork.PermissionTypeRepository.ExistAsync(x => x.Id == permissionTypeId); if (!exists) { return(HttpResponseHelper.NewResult(HttpStatusCode.BadRequest, HttpResponseHelper.NewHttpResponseWithElement <PermissionTypeDto>(error: "The permission type doesn't exist."))); } var permissionType = await _unitOfWork.PermissionTypeRepository.GetByIdAsync(permissionTypeId); var permissionTypeDto = _mapper.Map <PermissionTypeDto>(permissionType); return(HttpResponseHelper.NewResult(HttpStatusCode.OK, HttpResponseHelper.NewHttpResponseWithElement(element: permissionTypeDto, success: true))); } catch (Exception e) { return(HttpResponseHelper.NewResult(HttpStatusCode.InternalServerError, HttpResponseHelper.NewHttpResponseWithElement <PermissionTypeDto>(error: e.Message))); } }