Ejemplo n.º 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;
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 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);
        }