public override CategorySale[] GetSalesByFilmCategory(string category) { List <CategorySale> itemlist = new List <CategorySale>(); using (SakilaEntities dc = new SakilaEntities()) { var model = from c in dc.sales_by_film_category where c.category.Contains(category) orderby c.category select c; List <sales_by_film_category> sales = model.ToList(); for (int i = 0; i < sales.Count; i++) { CategorySale cs = new CategorySale(); if (sales[i].total_sales.HasValue) { cs = cs.Create(sales[i].category, sales[i].total_sales.Value); } else { cs = cs.Create(sales[i].category); } itemlist.Add(cs); } } return(itemlist.ToArray <CategorySale>()); }
public CategorySale Create(string category) { CategorySale cs = new CategorySale(); cs.category = category; return(cs); }
/// <summary> /// Create a new sales_by_film_category object. /// </summary> /// <param name="category">Initial value of the category property.</param> public CategorySale Create(string category, Decimal total_sales) { CategorySale cs = new CategorySale(); cs.category = category; cs.total_sales = total_sales; return(cs); }
public override CategorySale[] GetSalesByFilmCategory(string category) { List<CategorySale> itemlist = new List<CategorySale>(); using (SakilaEntities dc = new SakilaEntities()) { var model = from c in dc.sales_by_film_category where c.category.Contains(category) orderby c.category select c; List<sales_by_film_category> sales = model.ToList(); for (int i = 0; i < sales.Count; i++) { CategorySale cs = new CategorySale(); if (sales[i].total_sales.HasValue) { cs = cs.Create(sales[i].category, sales[i].total_sales.Value); } else { cs = cs.Create(sales[i].category); } itemlist.Add(cs); } } return itemlist.ToArray<CategorySale>(); }
public CategorySale Create(string category) { CategorySale cs = new CategorySale(); cs.category = category; return cs; }
/// <summary> /// Create a new sales_by_film_category object. /// </summary> /// <param name="category">Initial value of the category property.</param> public CategorySale Create(string category, Decimal total_sales) { CategorySale cs= new CategorySale(); cs.category = category; cs.total_sales = total_sales; return cs; }