public ActionResult EditGet(int id)
 {
     var noteService = new ElevenNote.Services.NoteService();
     var userID = Guid.Parse(User.Identity.GetUserId());
     var note = noteService.GetById(id, userID);
     return View(note);
 }
Exemple #2
0
        public ActionResult DeleteGet(int id)
        {
            var noteService = new ElevenNote.Services.NoteService();
            var userID      = Guid.Parse(User.Identity.GetUserId());
            var note        = noteService.GetById(id, userID);

            return(View(note));
        }
        public ActionResult DeletePost(int id)
        {
            var noteService = new ElevenNote.Services.NoteService();
            var userID = Guid.Parse(User.Identity.GetUserId());
            var result = noteService.Delete(id, userID);
            TempData.Add("Result", result ? "Note deleted." : "Note not deleted.");

            return RedirectToAction("Index");
        }
Exemple #4
0
        public ActionResult DeletePost(int id)
        {
            var noteService = new ElevenNote.Services.NoteService();
            var userID      = Guid.Parse(User.Identity.GetUserId());
            var result      = noteService.Delete(id, userID);

            TempData.Add("Result", result ? "Note deleted." : "Note not deleted.");

            return(RedirectToAction("Index"));
        }
Exemple #5
0
        // GET: Notes
        public ActionResult Index()
        {
            if (TempData["Result"] != null)
            {
                ViewBag.Success = TempData["Result"];
                TempData.Remove("Result");
            }
            var noteService = new ElevenNote.Services.NoteService();
            var notes       = noteService.GetAllForUser(Guid.Parse(User.Identity.GetUserId())); // must parse guid otherwise returns string.

            return(View(notes));
        }
Exemple #6
0
        public ActionResult EditPost(NoteEditViewModel model)
        {
            if (ModelState.IsValid)
            {
                var noteService = new ElevenNote.Services.NoteService();
                var userID      = Guid.Parse(User.Identity.GetUserId());
                var result      = noteService.Update(model, userID);
                TempData.Add("Result", result ? "Note updated." : "Note not updated.");

                return(RedirectToAction("Index"));
            }
            return(View(model));
        }
        public ActionResult CreatePost(NoteEditViewModel model)
        {
            if (ModelState.IsValid)
            {
                var noteService = new ElevenNote.Services.NoteService();
                var userID = Guid.Parse(User.Identity.GetUserId());
                var result = noteService.Create(model, userID);
                TempData.Add("Result", result ? "Note Added." : "Note not added.");

                return RedirectToAction("Index");
            }
            return View(model);
        }
 // GET: Notes
 public ActionResult Index()
 {
     if (TempData["Result"] != null)
     {
         ViewBag.Success = TempData["Result"];
         TempData.Remove("Result");
     }
     var noteService = new ElevenNote.Services.NoteService();
     var notes = noteService.GetAllForUser(Guid.Parse(User.Identity.GetUserId())); // must parse guid otherwise returns string.
     return View(notes);
 }