Example #1
0
        public ActionResult Create()
        {
            var linkCVM = new LinkCategoryViewModel();

            ViewBag.LinkCategories = new SelectList(linkCategoryService.GetLinkCategories(), "Id", "Name");
            return(View(linkCVM));
        }
Example #2
0
 public ActionResult Edit(LinkCategoryViewModel linkCVM)
 {
     if (ModelState.IsValid)
     {
         LinkCategory pc = linkCategoryService.GetLinkCategory(linkCVM.Id);
         pc.Name             = linkCVM.Name;
         pc.Slug             = linkCVM.Slug;
         pc.Description      = linkCVM.Description;
         pc.ParentCategoryId = linkCVM.ParentCategoryId;
         linkCategoryService.UpdateLinkCategory(pc);
         linkCategoryService.SaveLinkCategory();
         return(RedirectToAction("Index"));
     }
     ViewBag.LinkCategories = new SelectList(linkCategoryService.GetLinkCategories(), "Id", "Name", linkCVM.ParentCategoryId);
     return(View(linkCVM));
 }
Example #3
0
 public ActionResult Create(LinkCategoryViewModel linkCVM)
 {
     if (ModelState.IsValid)
     {
         var linkCategory = new LinkCategory();
         linkCategory.Name             = linkCVM.Name;
         linkCategory.Slug             = linkCVM.Slug;
         linkCategory.Description      = linkCVM.Description;
         linkCategory.ParentCategoryId = linkCVM.ParentCategoryId;
         linkCategoryService.CreateLinkCategory(linkCategory);
         linkCategoryService.SaveLinkCategory();
         return(RedirectToAction("Index"));
     }
     ViewBag.LinkCategories = new SelectList(linkCategoryService.GetLinkCategories(), "Id", "Name", linkCVM.ParentCategoryId);
     return(View(linkCVM));
 }
Example #4
0
        public ActionResult Edit(long id)
        {
            var linkCategory = linkCategoryService.GetLinkCategory(id);

            if (linkCategory != null)
            {
                LinkCategoryViewModel linkCVM = new LinkCategoryViewModel();
                linkCVM.Id               = linkCategory.Id;
                linkCVM.Name             = linkCategory.Name;
                linkCVM.Slug             = linkCategory.Slug;
                linkCVM.Description      = linkCategory.Description;
                linkCVM.ParentCategoryId = linkCategory.ParentCategoryId;
                ViewBag.LinkCategories   = new SelectList(linkCategoryService.GetLinkCategories(), "Id", "Name", linkCategory.ParentCategoryId);
                return(View(linkCVM));
            }

            return(RedirectToAction("Index"));
        }