Exemplo n.º 1
0
        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"
                    )
            });
        }