Exemplo n.º 1
0
        public IndexViewModel Create(string orderBy, string direction, int skip, int take, string filter)
        {
            ICultureRepository cultureRepository = this.RequestHandler.Storage.GetRepository <ICultureRepository>();

            return(new IndexViewModel()
            {
                Grid = new GridViewModelFactory(this.RequestHandler).Create(
                    orderBy, direction, skip, take, cultureRepository.Count(filter),
                    new[] {
                    new GridColumnViewModelFactory(this.RequestHandler).Create("Name", "Name"),
                    new GridColumnViewModelFactory(this.RequestHandler).CreateEmpty()
                },
                    cultureRepository.Range(orderBy, direction, skip, take, filter).ToList().Select(c => new CultureViewModelFactory(this.RequestHandler).Create(c)),
                    "_Culture"
                    )
            });
        }
        public IndexViewModel Build(string orderBy, string direction, int skip, int take)
        {
            ICultureRepository @classRepository = this.handler.Storage.GetRepository <ICultureRepository>();

            return(new IndexViewModel()
            {
                Grid = new GridViewModelBuilder(this.handler).Build(
                    orderBy, direction, skip, take, @classRepository.Count(),
                    new[] {
                    new GridColumnViewModelBuilder(this.handler).Build("Name", "Name"),
                    new GridColumnViewModelBuilder(this.handler).BuildEmpty()
                },
                    @classRepository.Range(orderBy, direction, skip, take).Select(c => new CultureViewModelBuilder(this.handler).Build(c)),
                    "_Culture"
                    )
            });
        }