コード例 #1
0
        public async Task <IActionResult> Create([Bind("TodoNodeId,Title,Description")] TodoNode todoNode)
        {
            if (ModelState.IsValid)
            {
                _context.Add(todoNode);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(todoNode));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("TodoNodeParentMapId,TodoNodeId,ParentNodeId")] TodoNodeParentMap todoNodeParentMap)
        {
            if (ModelState.IsValid)
            {
                _context.Add(todoNodeParentMap);
                await _context.SaveChangesAsync();

                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));
        }