Example #1
0
        public ActionResult Sign(FormCollection c)
        {
            Guest newGuest = new Guest();

            TryUpdateModel(newGuest);

            if (ModelState.IsValid)
            {
                GuestBook book = new GuestBook();
                try
                {
                    book.AddGuest(newGuest);
                }
                catch (ArgumentException e)
                {
                    ModelState.AddModelError("", e.Message);
                    return(View());
                }
                return(RedirectToAction("index", "home"));
            }
            return(View());
        }