public async Task <IActionResult> Edit(Guid id, [Bind("TodoId,CanBeStartedBefore,CategoryId,Deadline,Description,Name,Priority,StartDate,Status,StatusChangeDate,Type")] TODO tODO) { if (id != tODO.TodoId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tODO); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TODOExists(tODO.TodoId)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["CategoryId"] = new SelectList(_context.Category, "CategoryId", "CategoryId", tODO.CategoryId); return(View(tODO)); }
public async Task <IActionResult> Edit(int id, [Bind("CategoryId,Name")] Category category) { if (id != category.CategoryId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(category); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(category.CategoryId)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(category)); }
public async Task <IActionResult> Edit(Guid id, [Bind("PersonId,Name")] Person person) { if (id != person.PersonId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(person); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PersonExists(person.PersonId)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(person)); }