コード例 #1
0
        public ActionResult Edit(string titleUrl, ExampleDetailEM editModel)
        {
            if (!ModelState.IsValid)
                return View("Edit");

            var detail = Session.Query<Example>().Single(d => d.TitleUrl == titleUrl);
            Mapper.Map(editModel, detail);

            return RedirectToAction("Detail", new {id = detail.TitleUrl});
        }
コード例 #2
0
        public ActionResult Create(ExampleDetailEM editModel)
        {
            if (!ModelState.IsValid)
                return View("Edit");

            var detail = Mapper.Map<Example>(editModel);
            detail.Node = new Node();
            detail.CreatedAt = DateTime.UtcNow;
            Session.Store(detail);

            return RedirectToAction("Detail", new {id = detail.TitleUrl});
        }