Example #1
0
        /// <summary>
        /// Check if a user has made any payments
        /// </summary>
        /// <param name="tenantId"></param>
        /// <returns></returns>
        public bool HasPayments(int tenantId)
        {
            if (Get(tenantId) == null || _payments.GetAllFromTenant(tenantId).FirstOrDefault() == null)
            {
                return(false);
            }

            return(true);
        }
Example #2
0
        public IActionResult Tenant(int id)
        {
            if (!_tenants.HasPayments(id))
            {
                return(RedirectToAction("All"));
            }

            PaymentsFromTenantListModel model = new PaymentsFromTenantListModel()
            {
                Payments = _payments.GetAllFromTenant(id).Select(t => new PaymentItemModel()
                {
                    TenantId   = t.Tenant.Id,
                    TenantName = t.Tenant.FullName,
                    Amount     = t.Amount,
                    Date       = t.Date.ToString("dd/MM/yyyy")
                }),
                TenantId   = id,
                TenantName = _tenants.Get(id).FullName
            };

            return(View(model));
        }