Example #1
0
        public ActionResult Create(NoteViewModel noteViewModel)
        {
            var uow = UnitOfWorkProvider.GetCurrent();

            if (ModelState.IsValid)
            {
                var note = new Note()
                {
                    Text = noteViewModel.Text
                };

                var notesRepository = new IntKeyedRepository<Note>(uow.Session);
                notesRepository.Add(note);

                return RedirectToAction("Index");
            }

            return RedirectToAction("New");
        }