public ActionResult DeleteArticleManager(Product_category viewModel) { var manager = dbContext.Article_managers.Single(c => c.Id == viewModel.Id); dbContext.Article_managers.Remove(manager); dbContext.SaveChanges(); return(RedirectToAction("ListArticleManager", "Admin")); }
public ActionResult DeleteProductCategory(Product_category viewModel) { var category = dbContext.Product_categorys.Single(c => c.Id == viewModel.Id); dbContext.Product_categorys.Remove(category); dbContext.SaveChanges(); return(RedirectToAction("ListProtductModel", "Admin")); }
public ActionResult EditProductCategory(Product_category viewModel) { var category = dbContext.Product_categorys.Single(c => c.Id == viewModel.Id); category.Title = viewModel.Title; category.Parent_Id = viewModel.Parent_Id; dbContext.SaveChanges(); return(RedirectToAction("ListProtductModel", "Admin")); }
private void Execute_add_category(object o) { Product_category temp = new Product_category(); temp.Сategory = name; Name = ""; myBD.Product_category.Add(temp); myBD.SaveChanges(); Set_seting(); }
// Xóa Categoty public ActionResult DeleteProductCategory(int id) { var category = dbContext.Product_categorys.Single(c => c.Id == id); var categorys = new Product_category { Id = category.Id, Title = category.Title, Parent_Id = category.Parent_Id }; return(View(categorys)); }
public ActionResult CreateProductCategory(Product_category viewModel) { var category = new Product_category { Title = viewModel.Title, Parent_Id = viewModel.Parent_Id }; dbContext.Product_categorys.Add(category); dbContext.SaveChanges(); return(RedirectToAction("ListProtductModel", "Admin")); }
public object CreateCategory(object[] category) { try { Product_category row = new Product_category(); row.name = category[0].ToString(); row.description = category[1].ToString(); row.status = int.Parse(category[2].ToString()); row.created_at = DateTime.Now; db.Product_categories.InsertOnSubmit(row); db.SubmitChanges(); return("true"); } catch (Exception ex) { return(ex); } }