Beispiel #1
0
        public ActionResult Create(Menu menu)
        {
            if (ModelState.IsValid)
            {
                // TODO: Disabled to prevent XSS attacks
                //db.Menus.Add(menu);
                //db.SaveChanges();
                return RedirectToAction("Index");

            }

            return View(menu);
        }
Beispiel #2
0
 public ActionResult Edit(Menu menu)
 {
     if (ModelState.IsValid)
     {
         if (!IsAdminMenu(menu))
         {
             // TODO: Disabled to prevent XSS attacks on Demo
             //db.Entry(menu).State = EntityState.Modified;
             //db.SaveChanges();
         }
         return RedirectToAction("Index");
     }
     return View(menu);
 }
Beispiel #3
0
 //This is a hack to prevent script kiddie hackers,
 //from deleting the Main Menus in the Demo Site
 //Either remove this check or use it for something
 //more useful in your application
 private bool IsAdminMenu(Menu menu)
 {
     return (menu.Name == "Home" || menu.Name == "Menus");
 }