Пример #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");
        }