Esempio n. 1
0
 public ActionResult Edit(CategoriesCustomClass model)
 {
     if (ModelState.IsValid)
     {
         CategoriesData.EditCategories(model);
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }
Esempio n. 2
0
        //// 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));
        }
Esempio n. 3
0
 public ActionResult Create(CategoriesCustomClass model)
 {
     if (ModelState.IsValid)
     {
         CategoriesData.CreateCategories(model);
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View(model));
     }
 }
Esempio n. 4
0
        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));
        }
Esempio n. 5
0
 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));
     }
 }
Esempio n. 6
0
        //// 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));
        }