6.1: NoteController Changes
Make Changes in the NoteController.cs
NoteController.cspublic ActionResult Index() { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new NoteService(userId); var model = service.GetNotes(); return View(model); }[HttpPost] [ValidateAntiForgeryToken] public ActionResult Create(NoteCreate model) { if (!ModelState.IsValid) { return View(model); } var userId = Guid.Parse(User.Identity.GetUserId()); var service = new NoteService(userId); service.CreateNote(model); return RedirectToAction("Index"); } } }
Last updated