Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("TodoNodeParentMapId,TodoNodeId,ParentNodeId")] TodoNodeParentMap todoNodeParentMap)
        {
            if (id != todoNodeParentMap.TodoNodeParentMapId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(todoNodeParentMap);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TodoNodeParentMapExists(todoNodeParentMap.TodoNodeParentMapId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["ParentNodeId"] = new SelectList(_context.TodoNode, "TodoNodeId", "Title", todoNodeParentMap.ParentNodeId);
            ViewData["TodoNodeId"]   = new SelectList(_context.TodoNode, "TodoNodeId", "Title", todoNodeParentMap.TodoNodeId);
            return(View(todoNodeParentMap));
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int id, [Bind("TodoNodeId,Title,Description")] TodoNode todoNode)
        {
            if (id != todoNode.TodoNodeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(todoNode);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TodoNodeExists(todoNode.TodoNodeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(todoNode));
        }