コード例 #1
0
        public Product GetById(string id)
        {
            SqlRepository <Product> rep   = new SqlRepository <Product>(new SqlServerDefaultContext());
            IEnumerable <Product>   prods = rep.GetByProperty(x => x.ID == new Guid(id));

            return(prods.Count() > 0 ? prods.First() : null);
        }
コード例 #2
0
        public Category GetBySku(string name)
        {
            SqlRepository <Category> rep   = new SqlRepository <Category>(new SqlServerDefaultContext());
            IEnumerable <Category>   prods = rep.GetByProperty(x => x.Name == name);

            return(prods.First());
        }
コード例 #3
0
        public Product GetBySku(string sku)
        {
            SqlRepository <Product> rep   = new SqlRepository <Product>(new SqlServerDefaultContext());
            IEnumerable <Product>   prods = rep.GetByProperty(x => x.Sku == sku);

            return(prods.Count() > 0? prods.First():null);
        }