VideoRentalService.CategorySale.Create C# (CSharp) Method

Create() public method

public Create ( string category ) : CategorySale
category string
return CategorySale
        public CategorySale Create(string category)
        {
            CategorySale cs = new CategorySale();
            cs.category = category;
            return cs;
        }

Same methods

CategorySale::Create ( string category, Decimal total_sales ) : CategorySale

Usage Example

Ejemplo n.º 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>());
        }
All Usage Examples Of VideoRentalService.CategorySale::Create
CategorySale