Beispiel #1
0
        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));
        }
Beispiel #2
0
        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));
        }