Пример #1
0
 //This code loads up our database and turns it to an array.
 public static Cosmetics[] GetAllCosmetics()
 {
     using (var db = new CosmeticsModel())
     {
         var allCosmetics = db.CosmeticsList;
         return(allCosmetics.ToArray());
     }
 }
Пример #2
0
        public static Cosmetics GetCosmeticsItem(int itemNumber)
        {
            using (var db = new CosmeticsModel())
            {
                //db.CosmeticsList.Where(item => item.CosmeticItemNumber == itemNumber);

                // Check each item in the cosmetics list and return the first one that
                // matches the item number we're looking for.
                foreach (Cosmetics item in db.CosmeticsList)
                {
                    if (item.CosmeticItemNumber == itemNumber)
                    {
                        return(item);
                    }
                }
            }

            // If we couldn't find the item in the cosmetics list, just return null.
            return(null);
        }
Пример #3
0
 //This code loads up our database and turns it to an array.
 public static Cosmetics[] GetAllCosmetics()
 {
     using (var db = new CosmeticsModel())
     {
         var allCosmetics = db.CosmeticsList;
         return allCosmetics.ToArray();
     }
 }
Пример #4
0
        public static Cosmetics GetCosmeticsItem(int itemNumber)
        {
            using (var db = new CosmeticsModel())
            {
                //db.CosmeticsList.Where(item => item.CosmeticItemNumber == itemNumber);

                // Check each item in the cosmetics list and return the first one that
                // matches the item number we're looking for.
                foreach (Cosmetics item in db.CosmeticsList)
                {
                    if (item.CosmeticItemNumber == itemNumber)
                    {
                        return item;
                    }
                }
            }

            // If we couldn't find the item in the cosmetics list, just return null.
            return null;
        }