Exemple #1
0
        /// <summary>Add a new note</summary>
        public void AddNote(Note note)
        {
            note.IsDelete = ADDNOTE_IS_DELETE;
            note.CreationDate = DateTime.Now;

            _myNotesEntities.MyNotes.AddObject(note);
            _myNotesEntities.SaveChanges();
        }
Exemple #2
0
        /// <summary>Adding a new note action</summary>
        /// <param name="addNoteFdto">New note form data transfer object</param>
        /// <returns>Partial view: note</returns>
        public ActionResult AddNote(AddNoteFdto addNoteFdto)
        {
            var note = new Note
            {
                Content = addNoteFdto.Content,
            };

            _myNotesService.AddNote(note);

            return PartialView("_note", note);
        }
 /// <summary>
 /// Méthode déconseillée pour ajouter un nouvel objet à l'EntitySet MyNotes. Utilisez la méthode .Add de la propriété ObjectSet&lt;T&gt; associée à la place.
 /// </summary>
 public void AddToMyNotes(Note note)
 {
     base.AddObject("MyNotes", note);
 }
 /// <summary>
 /// Créez un nouvel objet Note.
 /// </summary>
 /// <param name="id">Valeur initiale de la propriété Id.</param>
 /// <param name="content">Valeur initiale de la propriété Content.</param>
 /// <param name="creationDate">Valeur initiale de la propriété CreationDate.</param>
 /// <param name="isDelete">Valeur initiale de la propriété IsDelete.</param>
 public static Note CreateNote(global::System.Int64 id, global::System.String content, global::System.DateTime creationDate, global::System.Boolean isDelete)
 {
     Note note = new Note();
     note.Id = id;
     note.Content = content;
     note.CreationDate = creationDate;
     note.IsDelete = isDelete;
     return note;
 }
        public void ViewDetailsExecute(Note note)
        {
            var selectedNote = note;
            //if (SelectedNote == null)
            //{
            //    return;
            //}

            int noteId = selectedNote.NoteId;
            NavigateToNoteDetails(noteId);
        }
        /// <summary>
        /// Navigates to Edit view
        /// </summary>
        /// <param name="note"></param>
        public void EditNoteExecute(Note note)
        {
            if (note == null)
            {
                return;
            }

            int noteId = note.NoteId;
            NavigateToNoteEdit(noteId);
        }
        /// <summary>
        /// Loads entity with specified id
        /// </summary>
        /// <param name="id"></param>
        public void Load(System.Int32 id)
        {
            var note = _context.Notes.Single(x => x.NoteId == id);
            if (note == null)
            {
                throw new InvalidOperationException(string.Format("Note with id {0} could not be found!", id));
            }

            Note = note;
        }
 /// <summary>
 /// Clean up resources here
 /// </summary>
 public void Cleanup()
 {
     this.Note = new Note();
 }