public ViewResult AddGuest(Guest guest, string Id)
 {
     guest.InviteID = Id;
     Invite invite = db.Invites.Single(x => x.Id == Id);
     if (!ModelState.IsValid)
         return View("ManageGuest", new Guest { InviteID = Id, Invite = invite });
     db.Guests.AddObject(guest);
     db.SaveChanges();
     ViewData["message"] = "Guest added successfully.";
     ViewData["returnUrl"] = Url.Action("ManageGuests", new { Id = guest.InviteID });
     return View("Result");
 }
        public ViewResult AddGuest(Guest guest)
        {
            ViewData["SelectedLink"] = "WeddingRSVP";
            guest.ConfirmReception = "No Answer";
            guest.ConfirmCeremony = "No Answer";

            if (!ModelState.IsValid)
            {
                Invite invite = db.Invites.Single(x => x.Id == guest.InviteID);
                return View(new Guest { Invite = invite, InviteID = guest.InviteID });
            }
            db.Guests.AddObject(guest);
            db.SaveChanges();
            ViewData["message"] = "A new guest has been added to your invitation!";
            ViewData["returnUrl"] = Url.Action("RSVP", new { Id = guest.InviteID });
            return View("result");
        }
 /// <summary>
 /// Create a new Guest object.
 /// </summary>
 /// <param name="guestID">Initial value of the GuestID property.</param>
 /// <param name="firstName">Initial value of the FirstName property.</param>
 /// <param name="lastName">Initial value of the LastName property.</param>
 /// <param name="inviteID">Initial value of the InviteID property.</param>
 /// <param name="confirmReception">Initial value of the ConfirmReception property.</param>
 /// <param name="confirmCeremony">Initial value of the ConfirmCeremony property.</param>
 /// <param name="invitedToCeremony">Initial value of the InvitedToCeremony property.</param>
 /// <param name="primaryGuest">Initial value of the PrimaryGuest property.</param>
 public static Guest CreateGuest(global::System.Int16 guestID, global::System.String firstName, global::System.String lastName, global::System.String inviteID, global::System.String confirmReception, global::System.String confirmCeremony, global::System.Boolean invitedToCeremony, global::System.Boolean primaryGuest)
 {
     Guest guest = new Guest();
     guest.GuestID = guestID;
     guest.FirstName = firstName;
     guest.LastName = lastName;
     guest.InviteID = inviteID;
     guest.ConfirmReception = confirmReception;
     guest.ConfirmCeremony = confirmCeremony;
     guest.InvitedToCeremony = invitedToCeremony;
     guest.PrimaryGuest = primaryGuest;
     return guest;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Guests EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToGuests(Guest guest)
 {
     base.AddObject("Guests", guest);
 }