Пример #1
0
        private string CustomersExist(Dto.Customer[] customers, Guid userId)
        {
            var result = string.Empty;

            var existingCustomers = _customerBusiness.GetAll(userId);

            if (existingCustomers == null)
            {
                return(result);
            }

            var customerTitles         = customers.Select(c => c.Title);
            var existingCustomerTitles = existingCustomers.Select(c => c.Title);

            var findings = from title in customerTitles
                           join existingTitle in existingCustomerTitles
                           on title equals existingTitle
                           select title;

            var array = findings as string[] ?? findings.ToArray();

            if (array.Any())
            {
                result = array.First();
            }

            return(result);
        }
Пример #2
0
 public List <Customer> GetAll()
 {
     return(_customerBusiness.GetAll());
 }