Exemplo n.º 1
0
        public static Category ParseCategory(MongoCategory category)
        {
            var result = new Category();

            result.CategoryName = category.CategoryName;

            return result;
        }
Exemplo n.º 2
0
        public static MongoCategory ParseToMongoCategory(Category category)
        {
            var result = new MongoCategory();

            result.CategoryId = category.CategoryId;
            result.CategoryName = category.CategoryName;

            return result;
        }
        public static void FillSampleCategories()
        {
            var categories = new string[] { "Smartphone", "Laptop", "Tablet", "PersonalComputer", "Oven", 
                                            "LED Tellevisor", "Microwave", "Toaster", "Printer", 
                                            "Vibrator", "Vacuum cleaner", "Boiler" };

            for (int i = 0; i < categories.Length; i++)
            {
                var category = new MongoCategory
                {
                    CategoryId = i,
                    CategoryName = categories[i],
                };

                MongoDbProvider.SaveData<MongoCategory>(MongoDbProvider.db, category);
            }
        }