2021-07-13 09:44:12 +10:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Web.Mvc;
|
2021-07-14 21:26:34 +10:00
|
|
|
|
using PartyInvites.Models;
|
2021-07-13 09:44:12 +10:00
|
|
|
|
|
|
|
|
|
namespace PartyInvites.Controllers
|
|
|
|
|
{
|
|
|
|
|
public class HomeController : Controller
|
|
|
|
|
{
|
2021-07-13 23:42:07 +10:00
|
|
|
|
public ActionResult Index()
|
2021-07-13 09:44:12 +10:00
|
|
|
|
{
|
2021-07-13 23:51:02 +10:00
|
|
|
|
int hour = DateTime.Now.Hour;
|
|
|
|
|
ViewBag.Greeting = hour < 12 ? "Good morning" : "Good afternoon";
|
2021-07-13 23:42:07 +10:00
|
|
|
|
return View();
|
2021-07-13 09:44:12 +10:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ActionResult About()
|
|
|
|
|
{
|
|
|
|
|
ViewBag.Message = "Your application description page.";
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ActionResult Contact()
|
|
|
|
|
{
|
|
|
|
|
ViewBag.Message = "Your contact page.";
|
|
|
|
|
return View();
|
|
|
|
|
}
|
2021-07-14 00:03:04 +10:00
|
|
|
|
|
2021-07-14 21:11:43 +10:00
|
|
|
|
[HttpGet]
|
2021-07-14 00:03:04 +10:00
|
|
|
|
public ActionResult RsvpForm()
|
|
|
|
|
{
|
|
|
|
|
return View();
|
|
|
|
|
}
|
2021-07-14 21:11:43 +10:00
|
|
|
|
|
|
|
|
|
[HttpPost]
|
2021-07-14 21:26:34 +10:00
|
|
|
|
public ActionResult RsvpForm(GuestResponse guestResponse)
|
2021-07-14 21:11:43 +10:00
|
|
|
|
{
|
2021-07-14 21:33:55 +10:00
|
|
|
|
if (ModelState.IsValid)
|
|
|
|
|
{
|
|
|
|
|
// TODO: Email guestResponse to the part organizer
|
|
|
|
|
return View("Thanks", guestResponse);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// there is a validation error - redisplay the for
|
|
|
|
|
return View();
|
|
|
|
|
}
|
2021-07-14 21:11:43 +10:00
|
|
|
|
}
|
2021-07-13 09:44:12 +10:00
|
|
|
|
}
|
|
|
|
|
}
|