public Customer UpdateWithSpec(int id)
        {
            IDataQuerySpecification <Customer> qrySpec = new CustomerDataQuerySpecification(cust => cust.Id == id && !cust.IsInactive);

            qrySpec.Includes.Add(cust => cust.DeliveryProducts);
            var c = qry.Find(qrySpec);

            c.Description      = $"Customer test {c.Name} - {DateTime.Now}";
            c.CommencementDate = DateTime.Today.AddMonths(-3);
            if (c.DeliveryProducts.Count > 0)
            {
                c.DeliveryProducts[0].Price = 11.50M;
                c.DeliveryProducts[0].SetDirty();
            }


            var dp = new DeliveryProduct()
            {
                Name      = $"DP {new Random().Next(1, 99)}",
                HasDate   = true,
                Price     = 20M,
                SortOrder = 20,
                IsNew     = true
            };

            c.DeliveryProducts.Add(dp);
            cmd.Update(c, cmdSpec);
            return(c);
        }
        public Customer FindSpec(int id)
        {
            Expression <Func <Customer, bool> > criteria = c => c.Id == id;
            var spec = new CustomerDataQuerySpecification(criteria);

            spec.Includes.Add(c => c.DeliveryProducts);
            var cust = qry.Find(spec);

            return(cust);
        }
        public IEnumerable <Customer> FilterSpec(string name)
        {
            Expression <Func <Customer, bool> > criteria = c => c.Name == name;
            var spec = new CustomerDataQuerySpecification(criteria);

            spec.Includes.Add(c => c.DeliveryProducts);
            var list = qry.Filter(spec);

            return(list);
        }