コード例 #1
0
        public ActionResult Create(EnvironmentCategory category)
        {
            if (ModelState.IsValid)
            {
                _environmentCategoryDao.Create(category);
                return(RedirectToAction("Index", "EnvironmentCategory"));
            }

            ViewBag.categories = _categories;
            return(View("Index"));
        }
コード例 #2
0
        public ActionResult Edit(EnvironmentCategory category)
        {
            if (ModelState.IsValid)
            {
                EnvironmentCategory cat = _environmentCategoryDao.GetById(category.Id);

                cat.Title       = category.Title;
                cat.Description = category.Description;

                _environmentCategoryDao.Update(cat);
                return(RedirectToAction("Index", "EnvironmentCategory"));
            }

            ViewBag.categories = _categories;
            EnvironmentCategory ec = _environmentCategoryDao.GetById(category.Id);

            return(View("Detail", ec));
        }
コード例 #3
0
        public ActionResult Detail(int id)
        {
            EnvironmentCategory environmentCategory = _environmentCategoryDao.GetById(id);

            return(View(environmentCategory));
        }