public ActionResult GetForm(Models.KhachMoi myGuest) { if (ModelState.IsValid) { return(View("Thanks", myGuest)); } else { return(View()); } }
public RedirectToRouteResult DangKyThanhVien(string name, string email, string sdt, string confirm) { Models.KhachMoi myGuest = new Models.KhachMoi(); myGuest.Ten = name; myGuest.Email = email; myGuest.Sdt = sdt; if (confirm == "Tham gia") { myGuest.XacNhanThamGia = true; } else { myGuest.XacNhanThamGia = false; } return(RedirectToAction("DangKyThanhCong", myGuest)); }
//RedirectToRoute(new { controller= "GiaiBai", action= "DangKyThanhCong"}) //[HttpPost] public ActionResult DangKyThanhCong(Models.KhachMoi myGuest) { ViewBag.Guest_Name = myGuest.Ten; ViewBag.Guest_Email = myGuest.Email; ViewBag.Guest_Phone = myGuest.Sdt; if (myGuest.XacNhanThamGia) { ViewBag.Guest_Confirm = "Sẽ tham gia"; ViewBag.Footer = "Rất vui vì bạn đã đăng ký tham gia"; } else { ViewBag.Guest_Confirm = "Không tham gia"; ViewBag.Footer = "Rất tiếc vì bạn không tham gia. Hẹn gặp bạn lần sau"; } return(View()); }