public ActionResult SendFeedBack(FeedBackViewModel feedBackViewModel) { if (ModelState.IsValid) { var newFeedBack = new FeedBack(); newFeedBack.UpdateFeedBack(feedBackViewModel); _feedBackSerive.Create(newFeedBack); _feedBackSerive.Save(); ViewData["SuccessMsg"] = "Gửi phản hồi thành công"; string content = System.IO.File.ReadAllText(Server.MapPath("/Assets/client/templates/contact_template.html")); content = content.Replace("{{Name}}", feedBackViewModel.Name); content = content.Replace("{{Email}}", feedBackViewModel.Email); content = content.Replace("{{Message}}", feedBackViewModel.Message); var adminEmail = ConfigHelper.GetByKey("AdminEmail"); MailHelper.SendMail(adminEmail, "Thông tin liên hệ từ website", content); feedBackViewModel.Name = ""; feedBackViewModel.Email = ""; feedBackViewModel.Message = ""; } else { MvcCaptcha.ResetCaptcha("contactCaptcha"); } feedBackViewModel.ContactDetailViewModel = GetContactDetail(); return(View("Index", feedBackViewModel)); }