public ActionResult Edit(CategoriesCustomClass model) { if (ModelState.IsValid) { CategoriesData.EditCategories(model); return(RedirectToAction("Index")); } return(View(model)); }
//// GET: Users/Edit/5 public ActionResult Edit(int id) { var result = CategoriesData.GetCategoriesById(id); var customCategory = new CategoriesCustomClass() { Name = result.name, Id = result.Id }; return(View(customCategory)); }
public ActionResult Create(CategoriesCustomClass model) { if (ModelState.IsValid) { CategoriesData.CreateCategories(model); return(RedirectToAction("Index")); } else { return(View(model)); } }
public ActionResult EditCategories(CategoriesCustomClass model) { var list = _db.categories.ToList(); ViewBag.ParentId = new SelectList(list, "Id", "Name"); if (ModelState.IsValid) { CategoriesData.EditCategories(model); return(RedirectToAction("CategoriesList")); } return(View(model)); }
public ActionResult CreateCategories(CategoriesCustomClass model) { //var CategoriesList = _db.categories.ToList(); //CategoriesList.Insert(0, new categories() { Id = 0, name = "სხვა" }); //ViewBag.ParentId = new SelectList(CategoriesList, "Id", "Name"); if (ModelState.IsValid) { CategoriesData.CreateCategories(model); return(RedirectToAction("CategoriesList")); } else { return(View(model)); } }
//// GET: Categories/Edit/5 public ActionResult EditCategories(int id) { var result = CategoriesData.GetCategoriesById(id); var list = _db.categories.ToList(); // list.Insert(0, new categories() { name = "-- Please Select --" }); list.Insert(list.Count, new categories() { Id = 0, name = "სხვა" }); ViewBag.ParentCategoryId = new SelectList(list, "Id", "Name", result.parentId); var customCategory = new CategoriesCustomClass() { Name = result.name, Id = result.Id, ParentId = result.parentId }; return(View(customCategory)); }