public ActionResult Index()
        {
            // Create the model
            var model = new TenantListViewModel();

            try
            {
                using (var ctx = new SaasDbContext())
                {
                    // Get tenants from the db
                    var tenants = ctx.Tenants.Include("Applications").ToList();

                    // Fill the view object
                    model.Tenants = tenants.Select(t => new TenantViewModel()
                    {
                        Tenant = t
                    }).ToList();
                }

                // Create the breadcrumb
                var breadcrumb = new List <BreadcrumbItemViewModel>();
                breadcrumb.Add(new BreadcrumbItemViewModel()
                {
                    Text = "Tenants"
                });
                ViewBag.Breadcrumb = breadcrumb;
            }

            catch (Exception ex)
            {
                LogService.Info("Tenants not found", ex.Message, ex.InnerException);
            }

            return(View(model));
        }
示例#2
0
        public ActionResult Index(int?page)
        {
            var viewModels = _tenantListQuery.GetPagedList(page ?? 1, DefaultPageSize);
            var viewModel  = new TenantListViewModel {
                Tenants = viewModels
            };

            return(View(viewModel));
        }