Exemplo n.º 1
0
        public ActionResult New(int parentId)
        {
            BLM blm = BLM.Load();

            Group parent   = (Group)blm.GetItemByID(parentId);
            Group newGroup = new Group()
            {
                Parent = parent
            };

            return(View(newGroup));
        }
Exemplo n.º 2
0
        public ActionResult Edit(int id, bool?dummy)
        {
            BLM blm = BLM.Load();

            Group group = (Group)blm.GetItemByID(id);

            if (!TryUpdateModel(group))
            {
                return(View(group));
            }

            blm.Save();

            return(RedirectToAction("Index", new { id = group.Parent.ID }));
        }
Exemplo n.º 3
0
        public ActionResult New(int parentId, Group group)
        {
            BLM blm = BLM.Load();

            if (!ModelState.IsValid)
            {
                Group parent = (Group)blm.GetItemByID(parentId);
                group.Parent = parent;

                return(View(group));
            }

            blm.AddGroup(parentId, group);

            return(RedirectToAction("Index", new { id = parentId }));
        }