Exemple #1
0
        public async Task <string> CreateGuestAsync(RegisterGuestInput input)
        {
            GuestEntry newEntry     = new GuestEntry();
            string     newEntryCode = CreateNewGuestCode();

            newEntry.CODE  = newEntryCode;
            newEntry.EMAIL = input.Email;
            database.Guest.Add(newEntry);
            int n = database.SaveChanges();

            if (n > 0)
            {
                //Step To send Email
                //if (await SendMailJectMailAsync(input.Message, input.Email))
                if (SendEmailNativeClient(input.Message, input.Email, newEntryCode))
                {
                    return("creation DONE");
                }
                else
                {
                    return("creation successful, Email sent error");
                }
            }
            else
            {
                //log error
                return("database insert error");
            }
        }
Exemple #2
0
        public ActionResult Create(GuestEntry entry)
        {
            if (entry.Name == "Fido")
            {
                throw new InvalidOperationException("No dogs allowed");
            }

            var book = new GuestBook();

            book.Add(entry);

            return(RedirectToAction("List"));
        }