示例#1
0
 public void Create(string name)
 {
     Category category = new Category();
     category.Name = name;
     dbCon.Categories.Add(category);
     dbCon.SaveChanges();
 }
 public ActionResult Create()
 {
     ViewBag.ParentId = new SelectList(db.Categories, "Id", "Name").InsertEmptyFirst("شاخه اصلی", "0");
     Category category = new Category();
     category.IconClass = "uk-icon-caret-right";
     return View(category);
 }
示例#3
0
 public ActionResult ChangeName(Category category)
 {
     if (ModelState.IsValid)
     {
         category.Name = HttpUtility.HtmlEncode(category.Name);
         _categoryService.Update(category);
     }
     return RedirectToAction("Index");
 }
示例#4
0
 public void Update(Category category)
 {
     Category _category = dbCon.Categories.SingleOrDefault(x => x.Id == category.Id);
     if (_category != null)
     {
         _category.Name = category.Name;
         dbCon.SaveChanges();
     }
 }
示例#5
0
 public Response()
 {
     Users = new List<ApplicationUser>();
     IdUserRoles = new List<IdentityUserRole>();
     IdRoles = new List<IdentityRole>();
     Hashtag = new Hashtag();
     Hashtags = new List<Hashtag>();
     BlogPost = new BlogPost();
     BlogPosts = new List<BlogPost>();
     StaticPage = new StaticPage();
     StaticPages = new List<StaticPage>();
     Category = new Category();
     Categories = new List<Category>();
     User = new ApplicationUser();
     BlogStats = new BlogStats();
 }
示例#6
0
 public ViewCategoryVM()
 {
     BlogPosts = new List<BlogPost>();
     Categories = new List<Category>();
     CurrentCategory = new Category();
 }
示例#7
0
 public void Update(Category category)
 {
     _categoryRepository.Update(category);
 }
示例#8
0
 public BlogPost()
 {
     Hashtags = new List<Hashtag>();
     User = new ApplicationUser();
     Category = new Category();
 }