Example #1
0
 public IActionResult NotesDelete(int id)
 {
     notesRepository.DeleteNote(new Note()
     {
         Id = id
     });
     return(RedirectToAction("Index"));
 }
        public IActionResult Delete(int id)
        {
            var identity = HttpContext.User.Identity as ClaimsIdentity;
            var userid   = identity.FindFirst(ClaimTypes.Name).Value;
            int Userid   = Int32.Parse(userid);

            var deleteID = NotesRepository.DeleteNote(id, Userid);

            if (deleteID == 0)
            {
                return(NotFound($"Not found item id: {id}"));
            }
            return(Ok($"Deleted item id: {deleteID}"));
        }
        public ActionResult Delete(int NoteID)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Authentication", new { ReturnUrl = @"/NoteActions/Delete/" + NoteID }));
            }

            int UserID = Convert.ToInt32(User.Identity.Name);

            if (NotesRepository.DeleteNote(NoteID, UserID, Server.MapPath("~")))
            {
                TempData["Message"] = "Draft Deleted";
            }
            else
            {
                TempData["Message"] = "Something Went Wrong, Deletion Unsuccessful";
            }

            return(RedirectToAction("Dashboard", "RegisteredUser"));
        }
Example #4
0
 public bool DelNote(int idNote)
 {
     NotesRepo.DeleteNote(idNote);
     return(true);
 }