コード例 #1
0
ファイル: NoteService.cs プロジェクト: Mivaweb/Notely
 /// <summary>
 /// Deletes a <see cref="Note"/> object
 /// </summary>
 /// <param name="note"></param>
 public void Delete(Note note)
 {
     using (var repo = new NotesRepository())
     {
         repo.Delete(note);
     }
 }
コード例 #2
0
ファイル: NoteService.cs プロジェクト: Mivaweb/Notely
 /// <summary>
 /// Deletes a <see cref="Note"/> object
 /// </summary>
 /// <param name="id"></param>
 public void Delete(int id)
 {
     using (var repo = new NotesRepository())
     {
         repo.Delete(id);
     }
 }
コード例 #3
0
        public ActionResult Delete(Note model)
        {
            try
            {
                // Conversation: Check ModelState IsValid? - No, just check the Id? - No, even the Id is not needed (Id will be hidden). - Yes it is hidden, but value from html is not and can be violated/changed.

                // Conversation: this maybe triggers validation and also get the html form values even that I have change them here in the back-end (So, put it first Always!).
                //TryValidateModel(model);

                // Conversation: this should be cleared (for certain keys) if validating those keys is not needed. - NOPE! Just remove the props/keys from Views (hidden TOO !!!)
                //if (ModelState.IsValid) { }


                _notesRepository.Delete(model.Id);

                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception ex)
            {
                return(View(model));
            }
        }
コード例 #4
0
ファイル: UserTest.cs プロジェクト: DenInHub/MyEvernote
        public void ShouldCleanUp()
        {
            var NoteRepository = new NotesRepository(_connectionstring);

            foreach (var id in NotesForTests)
            {
                NoteRepository.Delete(id);
            }

            var UsersRepository = new UsersRepository(_connectionstring);

            foreach (var id in UsersForTests)
            {
                UsersRepository.Delete(id);
            }

            var CategoriesRepository = new CategoriesRepository(_connectionstring);

            foreach (var id in CategoriesForTests)
            {
                CategoriesRepository.Delete(id);
            }
        }
コード例 #5
0
ファイル: NotesService.cs プロジェクト: t13ka/notes-sharing
 public void Delete(string title)
 {
     _notesRepository.Delete(title);
 }