/** * This method adds the new note object in the database. * It first creates a new Note objects and then manually assigns * the values NoteDTO object to this object. (NoteDTO - Note Data Transfer Object) **/ public bool Add(NoteDTO ObjNewNote) { // Note to be added to the database Note NewNote = new Note(); ObjNewNote.Date = DateTime.Today.ToString(); NewNote.Title = ObjNewNote.Title; NewNote.Type = ObjNewNote.Type; NewNote.Date = ObjNewNote.Date; NewNote.Content = ObjNewNote.Content; //ObjNotesList.Add(ObjNewNote); ObjContext.SaveNote(NewNote); return(true); }
/** * This method will be worked on later * * This method adds the new note object in the database. * It first creates a new Note objects and then manually assigns * the values NoteDTO object to this object. (NoteDTO - Note Data Transfer Object) **/ public bool Update(NoteDTO NoteToUpdate) { // Note to be updated in the database Note NewNote = new Note(); NewNote.Id = NoteToUpdate.Id; NewNote.Title = NoteToUpdate.Title; NewNote.Type = NoteToUpdate.Type; NewNote.Date = DateTime.Today.ToString(); // Since the Note is getting updated, the update time will be shown. NewNote.Content = NoteToUpdate.Content; // Calling htemethod from NoteDataAcces to updated the note in the database. if (ObjContext.UpdateNote(NewNote)) { return(true); } return(false); }