public IActionResult Index() { int month = DateTime.Now.Month; HomeViewModel model = new HomeViewModel { PropertyCount = _properties.GetNumberOfProperties(), TenantCount = _tenants.GetNumberOfTenants(), RentCollectedThisMonth = _payments.GetAmountFromMonth(month), PaymentsThisMonth = _payments.GetAllFromMonth(month).Select(p => new PaymentItemModel() { TenantId = p.Tenant.Id, TenantName = p.Tenant.FullName, Amount = p.Amount, Date = p.Date.ToString("dd/MM/yyyy") }) }; return(View(model)); }