Example #1
0
        public IEnumerable <PhoneContact> GetAll(Guid customerId, Guid hostelId)
        {
            var phoneContacts = _phoneContactRepository.List().Where(a => a.CustomerId == customerId);

            var customersIds        = _customerRepository.List().Where(a => a.HostelKey == hostelId).Select(a => a.Id).ToList();
            var hostelPhoneContacts = _phoneContactRepository.List().Where(a => customersIds.Contains(a.CustomerId) && a.Type == PhoneContactType.Local);

            return(phoneContacts.Concat(hostelPhoneContacts.Except(phoneContacts)));
        }