Ejemplo n.º 1
0
        public IViewComponentResult Invoke()
        {
            List <Category> categories = _unitOfWork.Category.GetAll().ToList();
            List <Service>  posts      = _unitOfWork.Service.GetAll().ToList();
            FooterVM        footerVM   = new FooterVM(categories, posts);

            return(View(footerVM));
        }
        public ActionResult MyFooter()
        {
            FooterVM footerData = new FooterVM();

            footerData.CompanyName = "Manoj Inc";
            footerData.Year        = DateTime.Now.Year.ToString();
            return(View("Footer", footerData));
        }
        public async Task <IViewComponentResult> InvokeAsync()
        {
            FooterVM model = new FooterVM()
            {
                Bio = _db.Bios.FirstOrDefault()
            };

            return(View(await Task.FromResult(model)));
        }
        public ActionResult Footer() // PartialView
        {
            ViewBag.MenuIndex = 2;
            FooterVM footerVM = new FooterVM {
                categories         = repoCategory.GetAll().Where(w => w.ParentID == null).Take(4).ToList(),
                brands             = repoBrand.GetAll().Take(4).ToList(),
                questionCategories = repoQuestionCategory.GetAll().Take(4).ToList()
            };

            return(PartialView(footerVM));
        }
        public async Task <IActionResult> Subscribe(FooterVM footerVM, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(NotFound());
            }
            bool exists = _db.Subscribers.Any(s => s.Email == footerVM.Subscriber.Email);

            if (exists)
            {
                return(NotFound());
            }
            Subscriber subscriber = footerVM.Subscriber;

            _db.Subscribers.Add(subscriber);
            await _db.SaveChangesAsync();

            return(LocalRedirect(returnUrl));
        }