コード例 #1
0
ファイル: CMSMapping.cs プロジェクト: W1R3D-Code/TheExordium
        /// <summary>
        /// Toes the CmsCategory edit model.
        /// </summary>
        /// <param name="CmsCategory">The CmsCategory.</param>
        /// <returns>New CmsCategory Edit Model</returns>
        public static CmsCategoryEditModel CmsCategoryToCmsCategoryEditModel(CmsCategory CmsCategory)
        {
            CmsCategoryEditModel model = new CmsCategoryEditModel
            {
                CategoryId = CmsCategory.CategoryId,
                Title = CmsCategory.Title,
            };

            return model;
        }
コード例 #2
0
ファイル: CMSMapping.cs プロジェクト: W1R3D-Code/TheExordium
        /// <summary>
        /// Froms the CmsCategory edit model.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns>New CmsCategory</returns>
        public static CmsCategory CmsCategoryEditModelToCmsCategory(CmsCategoryEditModel model)
        {
            CmsCategory CmsCategory = new CmsCategory
            {
                CategoryId = model.CategoryId,
                Title = model.Title,
            };

            return CmsCategory;
        }
コード例 #3
0
        public ActionResult EditCategory(CmsCategoryEditModel model)
        {
            CmsCategory category = new CmsCategory();

            if (cmsCategoryRepository.Categories.Count(c => c.CategoryId == model.CategoryId) > 0)
            {
                category = cmsCategoryRepository.Categories.Where(c => c.CategoryId == model.CategoryId).SingleOrDefault();
            }

            category = CmsMapping.CmsCategoryEditModelToCmsCategory(model);

            cmsCategoryRepository.SaveCategory(category);
            return RedirectToAction("Index", "CMS");
        }
コード例 #4
0
        public ActionResult EditCategory(int categoryId)
        {
            CmsCategory category = new CmsCategory();

            if (cmsCategoryRepository.Categories.Count(c => c.CategoryId == categoryId) > 0)
            {
                category = cmsCategoryRepository.Categories.Where(p => p.CategoryId == categoryId).SingleOrDefault();
            }

            CmsCategoryEditModel model = new CmsCategoryEditModel
            {
                CategoryId = category.CategoryId,
                New = false,
                Title = category.Title
            };

            return View(model);
        }