public async Task <IActionResult> Edit(int id, [Bind("Id,UserId,ToRead,StatusId")] WhatToRead whatToRead) { if (id != whatToRead.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(whatToRead); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WhatToReadExists(whatToRead.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(whatToRead)); }
public async Task <IActionResult> Create([Bind("Id,UserId,ToRead,StatusId")] WhatToRead whatToRead) { if (ModelState.IsValid) { _context.Add(whatToRead); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(whatToRead)); }