public ActionResult Create(RSVP rsvp)
 {
     try
     {
         // TODO: Add insert logic here
         //int dinnerId = (int)rsvp.DinnerId;
         //rsvp.Dinner = _repository.GetDinner(dinnerId);
         _repository.Add(rsvp);
         return RedirectToAction("Index", "RSVP", new { id = rsvp.DinnerId });
     }
     catch(Exception e)
     {
         return View();
     }
 }
Beispiel #2
0
        public ActionResult Register(int id)
        {
            var dinner = dinnerRepository.GetDinner(id);

            if(!dinner.IsUserRegistered(User.Identity.Name))
            {
                RSVP rsvp = new RSVP();
                rsvp.AttendeeName = User.Identity.Name;

                dinner.RSVPs.Add(rsvp);
                dinnerRepository.Save();

            }

            return Content("Thanks - we'll see you there!");
        }
 //
 // GET: /RSVP/Details/5
 //public ActionResult Details(int id)
 //{
 //    return View();
 //}
 //
 // GET: /RSVP/Create
 public ActionResult Create(int id)
 {
     RSVP rsvp = new RSVP();
     rsvp.DinnerId = id;
     return View(rsvp);
 }
 /// <summary>
 /// There are no comments for RSVP in the schema.
 /// </summary>
 public void AddToRSVP(RSVP rSVP)
 {
     base.AddObject("RSVP", rSVP);
 }
 /// <summary>
 /// Create a new RSVP object.
 /// </summary>
 /// <param name="rsvpID">Initial value of RsvpID.</param>
 /// <param name="attendeeName">Initial value of AttendeeName.</param>
 public static RSVP CreateRSVP(int rsvpID, string attendeeName)
 {
     RSVP rSVP = new RSVP();
     rSVP.RsvpID = rsvpID;
     rSVP.AttendeeName = attendeeName;
     return rSVP;
 }
 /// <summary>
 /// There are no comments for RSVP in the schema.
 /// </summary>
 public void AddToRSVP(RSVP rSVP)
 {
     base.AddObject("RSVP", rSVP);
 }
 public void Update(RSVP userStatus, int reminderXMinsBefore, bool isPrivate)
 {
     UserStatus          = userStatus;
     ReminderXMinsBefore = reminderXMinsBefore;
     IsPrivate           = isPrivate;
 }
Beispiel #8
0
        public async Task Post(RSVP model)
        {
            await _dbContext.RSVPs.AddAsync(model);

            await _dbContext.SaveChangesAsync();
        }
Beispiel #9
0
 public void InsertRSVP(RSVP guestBook)
 {
     RSVPRepository.InsertRSVP(guestBook);
 }
        public async Task <ActionResult> Rsvp(RsvpViewModel model)
        {
            if (!string.IsNullOrWhiteSpace(model.Website) || model.CaptchaPass == null || model.CaptchaPass != "KALASHIAN_NOT_ROBOT")
            {
                return(Json(new { status = 0, error = "Only humans can submit this form." }));
            }

            using (NickBeckyWedding db = new NickBeckyWedding())
                using (DbContextTransaction dbTrans = db.Database.BeginTransaction())
                {
                    RSVP rsvp = new RSVP
                    {
                        ArrivalDate  = model.ArrivalDate,
                        PrimaryEmail = model.EmailAddress,
                        Attending    = model.Attending
                    };

                    db.RSVPs.Add(rsvp);

                    try
                    {
                        await db.SaveChangesAsync();
                    }
                    catch (Exception ex)
                    {
                        dbTrans.Rollback();

                        return(Json(new { status = 0, error = ex.Message }));
                    }

                    RSVPAttendee primeAttendee = new RSVPAttendee
                    {
                        EmailAddress = model.EmailAddress,
                        Name         = model.Name,
                        RSVP_ID      = rsvp.ID
                    };

                    db.RSVPAttendees.Add(primeAttendee);

                    foreach (RSVPAttendee dbAttendee in model.Attendees.Where(attendee => attendee.EmailAddress != null).Select(attendee => new RSVPAttendee
                    {
                        EmailAddress = attendee.EmailAddress,
                        Name = attendee.Name,
                        RSVP_ID = rsvp.ID
                    }))
                    {
                        db.RSVPAttendees.Add(dbAttendee);
                    }

                    try
                    {
                        await db.SaveChangesAsync();

                        dbTrans.Commit();
                    }
                    catch (Exception ex)
                    {
                        dbTrans.Rollback();

                        return(Json(new { status = 0, error = ex.Message }));
                    }

                    await SendRsvpEmailAsync(model);
                }

            return(Json(new { status = 1 }));
        }
 public void Update(RSVP rsvp)
 {
     db.SubmitChanges();
 }
 public void Delete(RSVP rsvp)
 {
     db.RSVPs.DeleteOnSubmit(rsvp);
     db.SubmitChanges();
 }
 public void Add(RSVP rsvp)
 {
     db.RSVPs.InsertOnSubmit(rsvp);
     db.SubmitChanges();
 }
        public ActionResult RSVP([Bind(Include = "RSVPId,FirstName,LasttName,Email,Comment,Response")] RSVP rSVP, AdditionalRSVP[] additionalRSVP)
        {
            TrafficLogger();
            if (ModelState.IsValid)
            {
                string ipaddress;
                ipaddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                if (ipaddress == "" || ipaddress == null)
                {
                    ipaddress = Request.ServerVariables["REMOTE_ADDR"];
                }
                rSVP.IPAddress   = ipaddress;
                rSVP.CreatedDate = DateTime.Now;
                db.RSVPs.Add(rSVP);
                db.SaveChanges();

                ///////////////
                //Email guest RSVP confirmation
                ///////////////

                //if (rSVP.Email != null)
                //{
                //    const String FROM = "*****@*****.**";
                //    const String FROMNAME = "JJ and Liz";

                //    String TO = rSVP.Email;

                //    const String SMTP_USERNAME = "******";

                //    const String SMTP_PASSWORD = "******";

                //    const String HOST = "********";

                //    const int PORT = 587;

                //    String SUBJECT = "JJ + Liz RSVP Confirmation";

                //    // The body of the email
                //    String BODY =
                //        "<h1>Thanks for RSVPing!</h1>" +
                //        "<p>RSVP Confirmation:" +
                //        "<br />Name: " + rSVP.FirstName + " " + rSVP.LasttName +
                //        "<br />Response: " + rSVP.Response +
                //        "<br />Received on: " + rSVP.CreatedDate +
                //        "<br />Comment: " + rSVP.Comment +
                //        "<p>";


                //    if (additionalRSVP != null)
                //    {

                //        BODY = BODY + "<p>Additonal Guests: ";

                //        foreach (var item in additionalRSVP)
                //        {
                //            BODY = BODY +
                //            "<br />Name: " + item.FirstName + " " + item.LastName +
                //            "<br />Email: " + item.Email +
                //            "<br />Response: " + item.Response +
                //            "<p>";

                //        }
                //    };

                //    // Create and build a new MailMessage object
                //    MailMessage message = new MailMessage();
                //    message.IsBodyHtml = true;
                //    message.From = new MailAddress(FROM, FROMNAME);
                //    message.To.Add(new MailAddress(TO));
                //    message.Subject = SUBJECT;
                //    message.Body = BODY;
                //    SmtpClient client =
                //        new SmtpClient(HOST, PORT);

                //    client.Credentials =
                //        new NetworkCredential(SMTP_USERNAME, SMTP_PASSWORD);

                //    client.EnableSsl = true;

                //    // Send the email.
                //    try
                //    {
                //        System.Diagnostics.Trace.WriteLine("Attempting to send email...");
                //        client.Send(message);
                //        System.Diagnostics.Trace.WriteLine("Email sent!");
                //    }
                //    catch (Exception ex)
                //    {
                //        System.Diagnostics.Trace.WriteLine("The email was not sent.");
                //        System.Diagnostics.Trace.WriteLine("Error message: " + ex.Message);
                //    }
                //}

                //The if statement below checks to see if there are any additional RSVPs added to the main RSVP.
                //If they're additional RSVPs, add each to the database. If not, move on.
                if (additionalRSVP != null)
                {
                    foreach (var item in additionalRSVP)
                    {
                        AdditionalRSVP rsvp = new AdditionalRSVP
                        {
                            RSVPId      = rSVP.RSVPId,
                            FirstName   = item.FirstName,
                            LastName    = item.LastName,
                            Email       = item.Email,
                            Response    = item.Response,
                            CreatedDate = DateTime.Now
                        };
                        db.AdditionalRSVPs.Add(rsvp);
                        db.SaveChanges();

                        ////////////
                        //Email additional guest RSVP confirmation
                        ////////////

                        //if (item.Email != null)
                        //{
                        //    String FROM = "*****@*****.**";
                        //    String FROMNAME = "JJ and Liz";
                        //    string TO = item.Email;
                        //    string SUBJECT = rSVP.FirstName + " " + rSVP.LasttName + " has RSVP'd you for JJ and Liz's wedding!";

                        //    const String SMTP_USERNAME = "******";

                        //    const String SMTP_PASSWORD = "******";

                        //    const String HOST = "*****";

                        //    const int PORT = 587;

                        //    // The body of the email
                        //    string BODY =
                        //        "<h1>You've been RSVPd for by " + rSVP.FirstName + " " + rSVP.LasttName + ".  Thanks, " + rSVP.FirstName + "!</h1>" +
                        //        "<p>Your RSVP Confirmation:" +
                        //        "<br />Name: " + item.FirstName + " " + item.LastName +
                        //        "<br />Response: " + item.Response +
                        //        "<p>" + rSVP.FirstName + "'s RSVP: " +
                        //        "<br />Name: " + rSVP.FirstName + " " + rSVP.LasttName +
                        //        "<br />Response: " + rSVP.Response;

                        //    // Create and build a new MailMessage object
                        //    MailMessage message = new MailMessage();
                        //    message.IsBodyHtml = true;
                        //    message.From = new MailAddress(FROM, FROMNAME);
                        //    message.To.Add(new MailAddress(TO));
                        //    message.Subject = SUBJECT;
                        //    message.Body = BODY;
                        //    SmtpClient client =
                        //        new SmtpClient(HOST, PORT);

                        //    client.Credentials =
                        //        new NetworkCredential(SMTP_USERNAME, SMTP_PASSWORD);

                        //    client.EnableSsl = true;

                        //    // Send the email.
                        //    try
                        //    {
                        //        System.Diagnostics.Trace.WriteLine("Attempting to send email...");
                        //        client.Send(message);
                        //        System.Diagnostics.Trace.WriteLine("Email sent!");
                        //    }
                        //    catch (Exception ex)
                        //    {
                        //        System.Diagnostics.Trace.WriteLine("The email was not sent.");
                        //        System.Diagnostics.Trace.WriteLine("Error message: " + ex.Message);
                        //    }
                        //}
                    }
                }

                return(RedirectToAction("Confirmation"));
            }

            return(RedirectToAction("../Home/Error"));
        }
Beispiel #15
0
 public void UpdateRSVP(RSVP rsvp, int lastId, string lastGUID)
 {
     RSVPRepository.UpdateRSVP(rsvp, lastId, lastGUID);
 }
Beispiel #16
0
 public ActionResult Rsvp(long invitiationId, RSVP type)
 {
     var invitation = _eventService.RsvpForEvent(invitiationId, type);
     return RedirectToAction("Event", new { id = invitation.Event.Id });
 }
Beispiel #17
0
 public RSVP Create(RSVP rsvp)
 {
     return(_rsvpRepo.Insert(rsvp));
 }