コード例 #1
0
        public ActionResult Create(CategoryViewModel model)
        {
            var category = new Category();

            model.UpdateEntity(category, HttpContext.User.Identity.Name);

            Session.Save(category);

            return RedirectToAction("Index");
        }
コード例 #2
0
        public ActionResult Edit(CategoryViewModel model)
        {
            var category = Session.Get<Category>(model.Id);

            if (category == null) throw new Exception("Category is null");

            model.UpdateEntity(category, HttpContext.User.Identity.Name);

            Session.Save(category);

            return RedirectToAction("Index");
        }