public IQueryable<Location> GetLocations() { AdventureWorks2012Entities _db = new AdventureWorks2012Entities(); IQueryable<Location> query = _db.Locations; return query.OrderBy(i => i.LocationID); }
public IQueryable GetYears() { var _db = new Invensoft.Models.AdventureWorks2012Entities(); var query = (from y in _db.vSalesByYears group y by y.Year into g select new { Year = g.Key }); return query.OrderBy(y => y.Year); }
public IQueryable GetYears() { var _db = new Invensoft.Models.AdventureWorks2012Entities(); var query = (from y in _db.vSalesByYears group y by y.Year into g select new { Year = g.Key }); return(query.OrderBy(y => y.Year)); }
public IQueryable <ProductCategory> GetCategories() { if (Server.GetLastError() == null) { var _db = new Invensoft.Models.AdventureWorks2012Entities(); IQueryable <ProductCategory> query = _db.ProductCategories; return(query); } return(null); }
public IQueryable<ProductCategory> GetCategories() { if (Server.GetLastError() == null) { var _db = new Invensoft.Models.AdventureWorks2012Entities(); IQueryable<ProductCategory> query = _db.ProductCategories; return query; } return null; }
public IQueryable<vProductInventory> GetProductInventory([Control("location")] int? locationId) { AdventureWorks2012Entities _db = new AdventureWorks2012Entities(); IQueryable<vProductInventory> query = _db.vProductInventories; if (locationId.HasValue && locationId > 0) { query = query.Where(p => p.LocationID == locationId); } return query.OrderBy(i => i.ProductNumber).OrderBy(i => i.LocationID); }
public void SetProductPrice(Product p) { var _db = new AdventureWorks2012Entities(); var product = _db.Products.Where(pr => pr.ProductID == p.ProductID).FirstOrDefault(); product.ListPrice = p.ListPrice; TryUpdateModel(product); if (ModelState.IsValid) { _db.SaveChanges(); } }
public IQueryable<Product> GetProduct([QueryString("productId")] int? productId) { var _db = new AdventureWorks2012Entities(); IQueryable<Product> query = _db.Products; if (productId.HasValue && productId > 0) { query = query.Where(p => p.ProductID == productId); } else query = null; return query; }
public IQueryable <Product> GetProducts([QueryString("id")] int?categoryId, [RouteData] string categoryName) { var _db = new Invensoft.Models.AdventureWorks2012Entities(); IQueryable <Product> query = _db.Products; if (categoryId.HasValue && categoryId > 0) { query = query.Where(p => p.ProductSubcategoryID == categoryId); } if (!String.IsNullOrEmpty(categoryName)) { query = query.Where(p => String.Compare(p.ProductSubcategory.ProductCategory.Name, categoryName) == 0); } return(query); }
public IQueryable<Product> GetProducts([QueryString("id")] int? categoryId, [RouteData] string categoryName) { var _db = new Invensoft.Models.AdventureWorks2012Entities(); IQueryable<Product> query = _db.Products; if (categoryId.HasValue && categoryId > 0) { query = query.Where(p => p.ProductSubcategoryID == categoryId); } if (!String.IsNullOrEmpty(categoryName)) { query = query.Where(p => String.Compare(p.ProductSubcategory.ProductCategory.Name, categoryName) == 0); } return query; }
public IQueryable<vSalesByYear> GetSalesReport([Control("years")] int? year) { var _db = new Invensoft.Models.AdventureWorks2012Entities(); IQueryable<vSalesByYear> query = _db.vSalesByYears; if (year.HasValue && year > 0) { query = query.Where(p => p.Year == year); } // if (!String.IsNullOrEmpty(categoryName)) // { // query = query.Where(p => String.Compare(p.ProductSubcategory.ProductCategory.Name, categoryName) == 0); // } return query.OrderBy(s => s.ProductNumber); }
public IQueryable <vSalesByYear> GetSalesReport([Control("years")] int?year) { var _db = new Invensoft.Models.AdventureWorks2012Entities(); IQueryable <vSalesByYear> query = _db.vSalesByYears; if (year.HasValue && year > 0) { query = query.Where(p => p.Year == year); } // if (!String.IsNullOrEmpty(categoryName)) // { // query = query.Where(p => String.Compare(p.ProductSubcategory.ProductCategory.Name, categoryName) == 0); // } return(query.OrderBy(s => s.ProductNumber)); }