public IndexViewModel Create(string orderBy, string direction, int skip, int take, string filter) { IEndpointRepository endpointRepository = this.RequestHandler.Storage.GetRepository <IEndpointRepository>(); return(new IndexViewModel() { Grid = new GridViewModelFactory(this.RequestHandler).Create( orderBy, direction, skip, take, endpointRepository.Count(filter), new[] { new GridColumnViewModelFactory(this.RequestHandler).Create("Name", "Name"), new GridColumnViewModelFactory(this.RequestHandler).Create("URL template", "UrlTemplate"), new GridColumnViewModelFactory(this.RequestHandler).Create("Position", "Position"), new GridColumnViewModelFactory(this.RequestHandler).Create("Data sources"), new GridColumnViewModelFactory(this.RequestHandler).CreateEmpty() }, endpointRepository.Range(orderBy, direction, skip, take, filter).ToList().Select(m => new EndpointViewModelFactory(this.RequestHandler).Create(m)), "_Endpoint" ) }); }