예제 #1
0
        public async Task <ActionResult <ProductoPostMV> > Index()
        {
            var productos = _context.Productos.Include(x => x.Imagen)
                            .Include(x => x.Categoria).ToListAsync();
            var posts      = _context.Posts.Include(x => x.Imagenes).ToListAsync();
            var prodPostMv = new ProductoPostMV
            {
                Productos = await productos,
                Posts     = await posts
            };

            return(View(prodPostMv));
        }
예제 #2
0
        public async Task <ActionResult <ProductoPostMV> > Posts()
        {
            var posts = _context.Posts.Include(x => x.Calificaciones).
                        Include(y => y.Imagenes).Include(z => z.Comentarios).ToListAsync();
            var productos = _context.Productos.Include(x => x.Imagen)
                            .ToListAsync();
            var result = new ProductoPostMV
            {
                Posts     = await posts,
                Productos = await productos
            };

            ViewData["Aside"] = result;
            return(View(result));
        }
예제 #3
0
        public async Task <IActionResult> MapSite()
        {
            var posts = _context.Posts.Include(x => x.Calificaciones).
                        Include(y => y.Imagenes).Include(z => z.Comentarios).ToListAsync();
            var productos = _context.Productos.
                            Include(x => x.Imagen).ToListAsync();
            var share = new ProductoPostMV
            {
                Posts     = await posts,
                Productos = await productos
            };

            ViewData["Aside"] = share;
            return(View());
        }
예제 #4
0
        public async Task <ActionResult <Producto> > Dogs()
        {
            var dogProducts = _context.Productos.Include(x => x.Imagen)
                              .Where(x => x.TipoMascota == "perro").ToListAsync();
            var posts = _context.Posts.Include(x => x.Calificaciones).
                        Include(y => y.Imagenes).Include(z => z.Comentarios).ToListAsync();
            var productos = _context.Productos.
                            Include(x => x.Imagen).ToListAsync();
            var share = new ProductoPostMV
            {
                Posts     = await posts,
                Productos = await productos
            };

            ViewData["Aside"] = share;
            return(View(await dogProducts));
        }
예제 #5
0
        public async Task <ActionResult <PostProductoMV> > Post(long id)
        {
            var post           = _context.Posts.FindAsync(id);
            var productosxpost = _context.Productoxposts.Where(x => x.Post.Id.Equals(id)).ToListAsync();
            var posts          = _context.Posts.Include(x => x.Calificaciones).
                                 Include(y => y.Imagenes).Include(z => z.Comentarios).ToListAsync();
            var productos = _context.Productos.
                            Include(x => x.Imagen).ToListAsync();
            var share = new ProductoPostMV
            {
                Posts     = await posts,
                Productos = await productos
            };
            var result = new PostProductoMV
            {
                Post           = await post,
                Productoxposts = await productosxpost
            };

            ViewData["Aside"] = share;
            return(View(result));
        }