コード例 #1
0
        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"));
        }
コード例 #2
0
        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"));
        }
コード例 #3
0
        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"));
        }
コード例 #4
0
        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();
        }
コード例 #5
0
        // 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));
        }
コード例 #6
0
        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"));
        }
コード例 #7
0
        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);
            }
        }