Пример #1
0
        public IActionResult Index()
        {
            int?            userId    = User.Identity.GetUserId();
            List <UserNote> userNotes = new List <UserNote>();

            if (userId.HasValue)
            {
                userNotes = _userNoteService.GetuserNotes(userId.Value);
            }
            return(View(userNotes));
        }
        public IActionResult Index(UserNote userNote)
        {
            var id = User.GetUserId();

            if (id != null)
            {
                int userId = id.Value;
                if (ModelState.IsValid)
                {
                    userNote.UserId = userId;
                    _userNoteService.AddUserNote(userNote);
                    List <UserNote> userNotes = _userNoteService.GetuserNotes(userId);
                    return(View("../Home/Index", userNotes));
                }
            }
            return(View());
        }