Create() public method

public Create ( string category ) : CategorySale
category string
return CategorySale
コード例 #1
0
        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>());
        }
コード例 #2
0
        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>();
        }