public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Type,Description,personId")] Todolist todolist) { if (id != todolist.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(todolist); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TodolistExists(todolist.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(todolist)); }
public Overview createNewOverview(Person p, Todolist l) { if (p != null && l != null) { Overview o = new Overview(); o.Id = p.Id; o.Name = p.Name; o.Email = p.Email; o.Address = p.Address; o.Title = l.Title; o.Type = l.Type; o.Description = l.Description; return(o); } return(null); }
public async Task <IActionResult> Create([Bind("Id,Title,Type,Description,personId")] Todolist todolist) { if (ModelState.IsValid) { _context.Add(todolist); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(todolist)); }
public IActionResult CreateList(int pid) { Person p = GetPerson(pid); Todolist l = GetList(1); Overview o = createNewOverview(p, l); if (ModelState.IsValid) { _context.Add(o); } return(View(o)); }