コード例 #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));
        }
コード例 #2
0
        public ActionResult MyFooter()
        {
            FooterVM footerData = new FooterVM();

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

            return(View(await Task.FromResult(model)));
        }
コード例 #4
0
        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));
        }
コード例 #5
0
        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));
        }