Пример #1
0
        public ActionResult DeleteNote(NoteViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            var UserRepository = new IH.IhudBlog.Core.NHibernate.NHUserRepository();

            User UserNote = UserRepository.LoadById(model.UserId);

            model.User = UserNote;

            Note SaveNote = new Note();



            SaveNote            = NoteViewModel.Conversion(model);
            SaveNote.NoteStatus = 2;

            NoteRepository = new NHNoteRepository();

            NoteRepository.Save(SaveNote);


            return(RedirectToAction("Index"));
        }
Пример #2
0
        public ActionResult EditNote(NoteViewModel model, IEnumerable <HttpPostedFileBase> files)
        {
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError("", "Проверьте, что заполнены все поля! 😊");
                return(PartialView(model));
            }
            if (!ModelState.IsValid)
            {
                return(PartialView(model));
            }

            var UserRepository = new IH.IhudBlog.Core.NHibernate.NHUserRepository();

            User UserNote = UserRepository.LoadById(model.UserId);

            model.User = UserNote;

            Note SaveNote = new Note();

            SaveNote = NoteViewModel.Conversion(model);

            NoteRepository = new IH.IhudBlog.Core.NHibernate.NHNoteRepository();

            NoteRepository.Save(SaveNote);

            return(RedirectToAction("Index"));
        }