Ejemplo n.º 1
0
 public ComentService(IComentRepository comentRepository, IUnitOfWork unitOfWork)
 {
     _comentRepository = comentRepository;
     _unitOfWork       = unitOfWork;
 }
Ejemplo n.º 2
0
        public EFUnitOfWork(ICategoryRepository categoryRepository,
                            IPhotoRepository photoRepository,
                            IProductRepository productRepository,
                            IProductTypeRepository productTypeRepository, IOrderRepository orderRepository, IComentRepository comentRepository,
                            IShopCartRepository shopCartRepository, Context context)
        {
            CategoryRepository    = categoryRepository;
            PhotoRepository       = photoRepository;
            ProductRepository     = productRepository;
            ProductTypeRepository = productTypeRepository;
            OrderRepository       = orderRepository;
            ComentRepository      = comentRepository;
            ShopCartRepository    = shopCartRepository;
            _context = context;

            var categories = new List <Category>()
            {
                new Category {
                    Id = 1, Name = "Футболки"
                },
                new Category {
                    Id = 2, Name = "Куртки"
                },
                new Category {
                    Id = 3, Name = "Брюки"
                }
            };
            var photo = new List <Photo>
            {
                new Photo()
                {
                    Id = 1, Url = "https://images.satu.kz/46090190_futbolki-muzhskie.jpg", Alt = "Футболка"
                }, new Photo()
                {
                    Id = 2, Url = "https://images.satu.kz/46090190_futbolki-muzhskie.jpg", Alt = "Футболка"
                }
            };
            var photosTypes = new List <ProductType>()
            {
                new ProductType()
                {
                    Id = 1, Size = "Xl"
                },
                new ProductType()
                {
                    Id = 2, Size = "X"
                },
                new ProductType()
                {
                    Id = 3, Size = "L"
                }
            };
            var products = new List <Product>()
            {
                new Product
                {
                    Id           = 1,
                    Name         = "Обычная футболка", Category = categories[0], Count = 50,
                    Description  = "Обычные футболки для всех", Price = 500,
                    Photos       = photo,
                    ProductTypes = photosTypes
                },
                new Product
                {
                    Id           = 2,
                    Name         = "НеОбычная футболка", Category = categories[0], Count = 50,
                    Description  = "НеОбычные футболки для всех", Price = 500,
                    Photos       = photo,
                    ProductTypes = photosTypes
                },
                new Product
                {
                    Id           = 3,
                    Name         = "Обычная куртка", Category = categories[1], Count = 50, Description = "Обычные куртки для всех", Price = 500,
                    Photos       = photo,
                    ProductTypes = photosTypes
                },
                new Product
                {
                    Id           = 4,
                    Name         = "Необычная куртка", Category = categories[1], Count = 50, Description = "необычная куртка для всех", Price = 500,
                    Photos       = photo,
                    ProductTypes = photosTypes
                },
                new Product
                {
                    Id           = 5,
                    Name         = "Обычный брюк", Category = categories[2], Count = 50,
                    Description  = "Обычные брюки для всех", Price = 500,
                    Photos       = photo,
                    ProductTypes = photosTypes
                },
                new Product
                {
                    Id           = 6,
                    Name         = "Необынчый брюк", Category = categories[2], Count = 50,
                    Description  = "неОбычные брюки для всех", Price = 500,
                    Photos       = photo,
                    ProductTypes = photosTypes
                }
            };
            //  _context.Users.AddRange(_people);
            // _context.Products.AddRange(products);
            //      _context.SaveChanges();
        }