using AdventureWorks.Business;
using System;
using System.Collections.Generic;
using System.Linq;
namespace AdventureWorks.Business
{
///
/// Contains methods with related to shopping cart.
///
public class CategoryManager
{
///
/// Gets the categories.
///
/// The p.
///
public static List GetMainCategories()
{
var cats = from cat in Common.DataEntities.ProductCategories
select cat;
return cats.ToList();
}
///
/// Gets the name of the category by.
///
/// The name.
///
public static ProductCategory GetCategoryByName(string name)
{
var cats = from cat in Common.DataEntities.ProductCategories
where cat.Name == name
select cat;
return cats.FirstOrDefault();
}
///
/// Gets the name of the category by.
///
/// The name.
///
public static ProductSubcategory GetProductSubcategoryByName(string name)
{
var cats = from cat in Common.DataEntities.ProductSubcategories
where cat.Name == name
select cat;
return cats.FirstOrDefault();
}
}
}