public JsonResult EditModal(Category model) { Category temp = CategoryDAL.Get(x => x.CategoryID == model.CategoryID); temp.IsActive = false; CategoryDAL.Update(temp); Category temp2 = new Category() { CategoryID = Guid.NewGuid(), CategoryName = model.CategoryName, Description = model.Description, IsActive = true, SubCategoryID = temp.SubCategoryID, }; foreach (Make item in temp.Makes) { temp2.Makes.Add(item); } foreach (ProductModel item in temp.ProductModels) { temp2.ProductModels.Add(item); } foreach (Property item in temp.Properties) { temp2.Properties.Add(item); } CategoryDAL.Add(temp2); return(Json(true)); }
public ActionResult Edit(VMCategory model, Guid CategoryID, Guid id) { Category cat = CategoryDAL.Get(x => x.CategoryID == id); cat.IsActive = false; CategoryDAL.Update(cat); Category c = new Category(); c.CategoryID = Guid.NewGuid(); c.CategoryName = model.Category.CategoryName; c.Description = model.Category.Description; c.SubCategoryID = CategoryID; c.IsActive = true; foreach (var item in cat.Makes) { c.Makes.Add(item); } foreach (var item in cat.Properties) { c.Properties.Add(item); } foreach (var item in cat.ProductModels) { c.ProductModels.Add(item); } CategoryDAL.Add(c); return(RedirectToAction("Index", "Category")); }
public JsonResult AddModal(Category model) { model.CategoryID = Guid.NewGuid(); model.IsActive = true; CategoryDAL.Add(model); return(Json(true)); }
public ActionResult CategoryProcess(Category entity, HttpPostedFileBase file, string isNew) { if (file != null && file.ContentLength > 0 && file.ContentLength < 10485760) { string imagePath = new ImageUpload().ImageResize(file, 673, 483); if (isNew != "true") { string filePath = Server.MapPath(entity.PictureUrl); if (System.IO.File.Exists(filePath)) { System.IO.File.Delete(filePath); } } entity.PictureUrl = imagePath; } if (isNew == "true") { int result = catMng.Add(entity); } else { bool updateResult = catMng.Update(entity); } return(RedirectToAction("Kategoriİslemleri", "Category")); }
public IActionResult Add(CATEGORY CATEGORY) { if (CATEGORY.Id == 0) { _CategoryDAL.Add(CATEGORY); } else { _CategoryDAL.Update(CATEGORY); } return(Redirect("/Admin/Category/Index")); }
public ActionResult Add(Category model) { if (model.SubCategoryID == null) { model.SubCategoryID = Guid.Parse("35391ff3-c30d-4a6a-b30b-14079eaaa455"); } model.CategoryID = Guid.NewGuid(); model.IsActive = true; if (ModelState.IsValid) { if (CategoryDAL.GetList(x => x.SubCategoryID == model.SubCategoryID && x.IsActive == true).Where(x => x.CategoryName == model.CategoryName).FirstOrDefault() == null) { //bağlı tablolar taşınıyor... Category tempCategory = CategoryDAL.Get(x => x.CategoryID == model.SubCategoryID && x.IsActive == true); foreach (ProductModel item in tempCategory.ProductModels) { item.Category = model; } foreach (Property item in tempCategory.Properties) { model.Properties.Add(item); } tempCategory.Properties.Clear(); foreach (Make item in tempCategory.Makes) { model.Makes.Add(item); } tempCategory.Makes.Clear(); CategoryDAL.Add(model); } else { VMCategory vmCat = new VMCategory(); Guid temp = Guid.Parse("35391ff3-c30d-4a6a-b30b-14079eaaa455"); vmCat.Categories = CategoryDAL.GetList(x => x.SubCategoryID == temp); return(View(vmCat)); } } else { VMCategory vmCat = new VMCategory(); Guid temp = Guid.Parse("35391ff3-c30d-4a6a-b30b-14079eaaa455"); vmCat.Categories = CategoryDAL.GetList(x => x.SubCategoryID == temp); return(View(vmCat)); } return(RedirectToAction("Index", "Category")); }
private void btnAddCategories_Click(object sender, EventArgs e) { Category category = new Category() { Name = this.txbNameCategories.Text }; bool isValid = ValidationOperation <Category> .ValidateOperation(category); if (isValid) { CategoryDAL categoryDAL = new CategoryDAL(); categoryDAL.Add(category); MessageBox.Show("Successfully Added!"); categoryDAL.GetGridData(dgvCategory); } }
public JsonResult PostCategory(CategroyVM vm) { string message; Category category = new Category() { Name = vm.Name, CreatedBy = 1, CreationDate = DateTime.Now }; return(Json(new { done = CategroyDAL.Add(category, out message), message, add = true }, JsonRequestBehavior.AllowGet)); }
//点击 “确定”按钮 private void btnOK_Click(object sender, EventArgs e) { string title = txtTitle.Text.Trim(); var newCategory = new CategoryInfo() { CategoryName = title }; if (_category == null) { //添加新的分类 CategoryDAL.Add(newCategory); } else { //修改已有分类 CategoryDAL.Update(_category.ID, newCategory); } //触发 DataChanged 事件 OnDataChanged(); Close(); }
static public bool Add(Category category, out string msg) { return(CategoryDAL.Add(category, out msg)); }
public bool AddCategory(Category category, byte[] image) { category.Image = image; return(categoryDAL.Add(category) > 0); }
public static void Add(CategoryDTO category) { CategoryDAL.Add(CategoryCast.ToDAL(category)); }
public void Add(CategoryDTO DTO) { DAL.Add(DTO); }
/// <summary> ///Add /// </summary> public int Add(Category model) { return(dal.Add(model)); }