Esempio n. 1
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));
        }
Esempio n. 2
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));
        }