Beispiel #1
0
 public async Task ContactAsync([FromBody] Contact guest)
 {
     if (ModelState.IsValid)
     {
         GuestBook Guest = new GuestBook(guest.Name,
                                         guest.Email,
                                         guest.Phone,
                                         guest.Message);
         EmailingService emailingService = new EmailingService(_config);
         await emailingService.SendConfirmationEmail(Guest);
     }
 }
Beispiel #2
0
        public async Task <IActionResult> RSVPAsync([FromBody] Guest guest)
        {
            if (ModelState.IsValid)
            {
                RSVP Rsvp = new RSVP(guest.SelectedValue[0],
                                     Convert.ToBoolean(guest.SelectedValue[1]),
                                     guest.Name,
                                     guest.Email,
                                     guest.Phone,
                                     guest.Message);

                EmailingService emailingService = new EmailingService(_config);
                await emailingService.SendConfirmationEmail(Rsvp);

                return(Ok());
            }

            return(BadRequest("Sorry, RSVP not formatted correctly."));
        }