예제 #1
0
 public ActionResult Create(BlogCategoryFormModel obj, bool continueEditing)
 {
     if (ModelState.IsValid)
     {
         BlogCategory blog = Mapper.Map <BlogCategoryFormModel, BlogCategory>(obj);
         var          slug = StringConvert.ConvertShortName(blog.Name);
         blog.Slug = slug;
         _blogCategoryService.CreateBlogCategory(blog);
         return(continueEditing ? RedirectToAction("Edit", "BlogCategory", new { Id = blog.Id })
                         : RedirectToAction("Index", "BlogCategory"));
     }
     else
     {
         var listCategory = _blogCategoryService.GetBlogCategories().ToSelectListItems(-1);
         obj.ListCategory = listCategory;
         return(View("Create", obj));
     }
 }