Esempio n. 1
0
        public IActionResult Index()
        {
            var contact = _contactService.GetById("Default");
            var model   = new PageContactViewModel()
            {
                Contact = contact
            };

            return(View(model));
        }
Esempio n. 2
0
        public async Task <IActionResult> Index(PageContactViewModel model)
        {
            if (ModelState.IsValid)
            {
                model.Feedback.DateCreated = DateTime.Now;
                _feedbackService.Add(model.Feedback);
                _feedbackService.SaveChanges();
                var content = await _viewRenderService.RenderToStringAsync("Contact/ContactMail", model.Feedback);

                await _emailSender.SendEmailAsync(_configuration["MailSettings:AdminMail"], "Bạn Có 1 Phản Hồi Mới", content);

                ViewData["Success"] = true;
            }

            model.Contact = _contactService.GetById("default");

            return(View("Index", model));
        }