public async Task <IActionResult> Edit(string id, string NoteAvatar, [Bind("Id,Owner,OwnerId,Title,Content,Changed,Created,NoteAvatar")] Note note) { if (id != note.Id) { return(NotFound()); } if (ModelState.IsValid) { try { string noteTitle = note.Title; string avatar = GetAvas(noteTitle); note.NoteAvatar = avatar; note.Changed = DateTime.Now; _context.Update(note); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NoteExists(note.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(note)); }
public async Task <IActionResult> Edit(string id, [Bind("Id,Owner,Title,Content,Created,Changed")] Note note) { if (id != note.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(note); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NoteExists(note.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(note)); }