Ejemplo n.º 1
0
        public IndexViewModel Create(string orderBy, string direction, int skip, int take, string filter)
        {
            IPaymentMethodRepository paymentMethodRepository   = this.RequestHandler.Storage.GetRepository <IPaymentMethodRepository>();
            IStringLocalizer <IndexViewModelFactory> localizer = this.RequestHandler.GetService <IStringLocalizer <IndexViewModelFactory> >();

            return(new IndexViewModel()
            {
                Grid = new GridViewModelFactory(this.RequestHandler).Create(
                    orderBy, direction, skip, take, paymentMethodRepository.Count(filter),
                    new[] {
                    new GridColumnViewModelFactory(this.RequestHandler).Create(localizer["Code"], "Code"),
                    new GridColumnViewModelFactory(this.RequestHandler).Create(localizer["Name"], "Name"),
                    new GridColumnViewModelFactory(this.RequestHandler).Create(localizer["Position"], "Position"),
                    new GridColumnViewModelFactory(this.RequestHandler).CreateEmpty()
                },
                    paymentMethodRepository.Range(orderBy, direction, skip, take, filter).ToList().Select(pm => new PaymentMethodViewModelFactory(this.RequestHandler).Create(pm)),
                    "_PaymentMethod"
                    )
            });
        }