Пример #1
0
        public ActionResult EditDescription(Guid id)
        {
            var model = new NoteEditDescriptionModel();

            var userId = ReadStorage.Query(new QueryUserIdByEmail(User.Identity.Name));
            var readModel = ReadStorage.Query(new QueryNoteById(userId, id));

            model.Title = readModel.Title;
            model.Description = readModel.DescriptionRaw;

            return View(model);
        }
Пример #2
0
        public ActionResult EditDescription(Guid id, NoteEditDescriptionModel model)
        {
            if(!ModelState.IsValid)
            {
                return View(model);
            }

            var userId = ReadStorage.Query(new QueryUserIdByEmail(User.Identity.Name));

            _executor.Execute(new ChangeNoteDescription(userId, id, model.Description));

            return RedirectToAction("Index", "Contexts");
        }