public Page Map(PageEditModel editModel)
        {
            var page = Mapper.Map<Page>(editModel);

            page.Slug = this.slugMaker.CreateSlug(page.Title);

            return page;
        }
Exemplo n.º 2
0
        public ActionResult Save(PageEditModel editModel)
        {
            if(!this.ModelState.IsValid)
            {
                return this.Json(new { error = true });
            }

            var slugMaker = new SlugMaker();

            var mapper = new PageEditModelToPageMapper(this.session, slugMaker);
            var page = mapper.Map(editModel);

            this.session.Store(page);
            this.session.SaveChanges();

            return this.Json(page);
        }