public async Task <ActionResult <EncourgingNoteItem> > PostTodoItem(EncourgingNoteItem encourgingNoteItem)
        {
            _context.EncourgingNoteItems.Add(encourgingNoteItem);

            //set NoteNumber to the note's id
            encourgingNoteItem.NoteNumber = encourgingNoteItem.Id;

            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetEncourgingNoteItem", new { id = encourgingNoteItem.Id }, encourgingNoteItem));
        }
        public async Task <IActionResult> PutTodoItem(long id, EncourgingNoteItem encourgingNoteItemodoItem)
        {
            if (id != encourgingNoteItemodoItem.Id)
            {
                return(BadRequest());
            }

            _context.Entry(encourgingNoteItemodoItem).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(NoContent());
        }
        public EncourgingNoteController(EncourgingNoteContext context)
        {
            _context = context;

            if (_context.EncourgingNoteItems.Count() == 0)
            {
                // Create a new EncourgingNoteItem if collection is empty,
                // which means you can't delete all EncourgingNoteItems.
                var newNote = new EncourgingNoteItem
                {
                    Text = "Have a great day!"
                };
                //set NoteNumber to the note's id
                newNote.NoteNumber = newNote.Id;

                _context.EncourgingNoteItems.Add(newNote);

                _context.SaveChanges();
            }
        }