public ActionResult EditGet(int id) { var noteService = new Services.NoteService(); var userId = Guid.Parse(User.Identity.GetUserId()); var note = noteService.GetById(id, userId); return View(note); }
public ActionResult DeleteGet(int id) { var noteService = new Services.NoteService(); var userId = Guid.Parse(User.Identity.GetUserId()); var note = noteService.GetById(id, userId); return(View(note)); }
///<summary /// Gets all the notes for the current user. /// </summary> /// <returns></returns> public IHttpActionResult GetNotes() { var service = new Services.NoteService(); var userId = User.Identity.GetUserId(); var notes = service.GetAllForUser(Guid.Parse(userId)); return Ok(notes); }
///<summary /// Gets all the notes for the current user. /// </summary> /// <returns></returns> public IHttpActionResult GetNotes() { var service = new Services.NoteService(); var userId = User.Identity.GetUserId(); var notes = service.GetAllForUser(Guid.Parse(userId)); return(Ok(notes)); }
public ActionResult DeletePost(int id) { var noteService = new 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"); }
public ActionResult DeletePost(int id) { var noteService = new 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")); }
public ActionResult EditPost(NoteEditViewModel model) { if (ModelState.IsValid) { var noteService = new 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)); }
// GET: Notes public ActionResult Index() { if (TempData["Result"] != null) { ViewBag.Success = TempData["Result"]; TempData.Remove("Result"); } var noteService = new Services.NoteService(); var notes = noteService.GetAllForUser(Guid.Parse(User.Identity.GetUserId())); return(View(notes)); }
public ActionResult CreatePost(NoteEditViewModel model) { if (ModelState.IsValid) { var noteService = new 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 Services.NoteService(); var notes = noteService.GetAllForUser(Guid.Parse(User.Identity.GetUserId())); return View(notes); }