Exemplo n.º 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);
        }
Exemplo n.º 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());
        }
Exemplo n.º 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);
        }