Example #1
0
        /// <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;
        }
Example #2
0
        /// <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;
        }
Example #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");
        }
Example #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);
        }