Beispiel #1
0
 public ActionResult Index(Information info)
 {
     // this ensures all validation rules for the model have passed
     if (ModelState.IsValid)
     {
         if (AutoInformation.AddInfo(info))
         {
             ViewBag.Added = true;
         }
     }
     return(View());
 }
        public ActionResult Index(FormCollection formData)
        {
            Information info = new Information
            {
                SiteName = formData["sn"],
                URL      = formData["URL"]
            };

            // if everything is valid, add to database
            if (AutoInformation.AddInfo(info))
            {
                // viewbag data only works for the current request
                ViewBag.LinkAdded = true;
            }

            // let the user know it was successful or Display error message(s)
            return(View());
        }