Exemple #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);
 }
Exemple #3
0
 public ActionResult ChangeName(Category category)
 {
     if (ModelState.IsValid)
     {
         category.Name = HttpUtility.HtmlEncode(category.Name);
         _categoryService.Update(category);
     }
     return RedirectToAction("Index");
 }
Exemple #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();
     }
 }
Exemple #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();
 }
Exemple #6
0
 public ViewCategoryVM()
 {
     BlogPosts = new List<BlogPost>();
     Categories = new List<Category>();
     CurrentCategory = new Category();
 }
Exemple #7
0
 public void Update(Category category)
 {
     _categoryRepository.Update(category);
 }
Exemple #8
0
 public BlogPost()
 {
     Hashtags = new List<Hashtag>();
     User = new ApplicationUser();
     Category = new Category();
 }