public IndexViewModel Build(int userId, string orderBy, string direction, int skip, int take) { ICredentialRepository credentialRepository = this.handler.Storage.GetRepository <ICredentialRepository>(); return(new IndexViewModel() { UserId = userId, Grid = new GridViewModelBuilder(this.handler).Build( orderBy, direction, skip, take, credentialRepository.CountByUserId(userId), new[] { new GridColumnViewModelBuilder(this.handler).Build("Credential Type"), new GridColumnViewModelBuilder(this.handler).Build("Identifier", "Identifier"), new GridColumnViewModelBuilder(this.handler).BuildEmpty() }, credentialRepository.Range(userId, orderBy, direction, skip, take).Select(c => new CredentialViewModelBuilder(this.handler).Build(c)), "_Credential" ) }); }
public IndexViewModel Create(int userId, string orderBy, string direction, int skip, int take, string filter) { ICredentialRepository credentialRepository = this.RequestHandler.Storage.GetRepository <ICredentialRepository>(); return(new IndexViewModel() { UserId = userId, Grid = new GridViewModelFactory(this.RequestHandler).Create( orderBy, direction, skip, take, credentialRepository.CountByUserId(userId, filter), new[] { new GridColumnViewModelFactory(this.RequestHandler).Create("Credential Type"), new GridColumnViewModelFactory(this.RequestHandler).Create("Identifier", "Identifier"), new GridColumnViewModelFactory(this.RequestHandler).CreateEmpty() }, credentialRepository.FilteredByUserIdRange(userId, orderBy, direction, skip, take, filter).ToList().Select(c => new CredentialViewModelFactory(this.RequestHandler).Create(c)), "_Credential" ) }); }