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); }
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()); }
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); }