public async Task <IActionResult> Create([Bind("Id,Owner,Title,Content,Created,Changed")] Note note) { if (ModelState.IsValid) { _context.Add(note); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(note)); }
public async Task <IActionResult> Create([Bind("Id,Owner,OwnerId,Title,Content,Created,Changed")] Note note) { if (ModelState.IsValid) { //note.Changed = note.Created= DateTime.Now; string noteTitle = note.Title; string avatar = GetAvas(noteTitle); note.NoteAvatar = avatar; _context.Add(note); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(note)); }