public async Task <TResponse <UserRes> > GetById(int userId) { try { var user = await _readOnlyRepository.QueryFirstOrDefaultAsync <User>( SqlQuery.USER_GET_BY_ID, new { Id = userId }); if (user != null) { if (user.IsSuccess) { return(await Ok(Mapper.Map <UserRes>(user.Data))); } return(await Fail <UserRes>(user.Message)); } return(await Ok <UserRes>(null)); } catch (Exception exception) { return(await Fail <UserRes>(exception)); } }
public async Task <TResponse <IdentityResourceRes> > GetById(int identityResourceId) { try { var identityResource = await _readOnlyRepository.QueryFirstOrDefaultAsync <IdentityResource>( SqlQuery.IDENTITY_RESOURCE_GET_BY_ID, new { Id = identityResourceId }); if (identityResource != null) { if (identityResource.IsSuccess) { return(await Ok(Mapper.Map <IdentityResourceRes>(identityResource.Data))); } return(await Fail <IdentityResourceRes>(identityResource.Message)); } return(await Ok <IdentityResourceRes>(null)); } catch (Exception exception) { return(await Fail <IdentityResourceRes>(exception)); } }
public async Task <TResponse <ApiGroupRes> > GetById(int apiGroupId) { try { var apiGroup = await _readOnlyRepository.QueryFirstOrDefaultAsync <ApiGroup>( SqlQuery.API_GROUP_GET_BY_ID, new { Id = apiGroupId }); if (apiGroup != null) { if (apiGroup.IsSuccess) { return(await Ok(Mapper.Map <ApiGroupRes>(apiGroup.Data))); } return(await Fail <ApiGroupRes>(apiGroup.Message)); } return(await Ok <ApiGroupRes>(null)); } catch (Exception exception) { return(await Fail <ApiGroupRes>(exception)); } }