Пример #1
0
        public static List <Apartments> GetAllThatAreRegisteredWithSpecificCounters(int associationId, int assExpenseId, int?stairCase = null)
        {
            var result = new List <Apartments>();

            AssociationExpenses associationExpense = AssociationExpensesManager.GetById(assExpenseId);

            if (associationExpense != null)
            {
                List <Apartments> allApartments;
                if (stairCase.HasValue)
                {
                    allApartments = Get(associationId, stairCase.Value);
                }
                else
                {
                    allApartments = Get(associationId);
                }

                foreach (var apartment in allApartments)
                {
                    IEnumerable <AssociationCounters> counters = AssociationCountersManager.GetByApartment(apartment.Id);

                    if (counters.Any(c => c.Id_Expense == associationExpense.Expenses.Id))
                    {
                        result.Add(apartment);
                    }
                }
            }

            return(result);
        }
Пример #2
0
        public static bool HasCounterOfExpense(int apartmentId, int expenseId)
        {
            var counters = AssociationCountersManager.GetByApartment(apartmentId);

            return(counters.Any(c => c.Id_Expense == expenseId));
        }