Esempio n. 1
0
        private ActionResult Create(string path, Node model)
        {
            var structure = PrimeViewBag(path);

            model.Author   = "dummy"; // TODO: JIRA#2: replace with currently logged in user
            model.ParentId = structure.Last().Id;
            var newId = _nodeProvider.InsertNode(model);

            if (newId > 0)
            {
                structure.Nodes.Add(model);
                return(RedirectToAction("Display", new { path = structure.Path }));
            }

            ModelState.AddModelError("Name", "Name already exists");
            return(RedirectToAction("Create", new { path = structure.Path }));
        }