コード例 #1
0
        public ActionResult Insert(SubCategory item, HttpPostedFileBase resim)
        {
            ViewBag.CategoryID = new SelectList(cs.GetActive(), "ID", "CategoryName", item.CategoryID);
            if (ModelState.IsValid)
            {
                bool   result;
                string fileResult = FxFunction.ImageUpload(resim, ImageFile.SubCategories, out result);
                if (result)
                {
                    item.ImagePath = fileResult;
                }
                else
                {
                    ViewBag.Message = fileResult;
                }
                bool sonuc = ss.Add(item);

                if (sonuc)
                {
                    ViewBag.Message = "Ekleme İşlemi Başarılı";
                    return(RedirectToAction("Index", new { id = item.CategoryID }));
                }
                else
                {
                    ViewBag.Message = "Ekleme İşlemi Başarısız";
                }
            }
            return(View());
        }
コード例 #2
0
        public ActionResult Add(SubCategory data)
        {
            data.ID = Guid.NewGuid();
            sub.Add(data);

            return(RedirectToAction("Index"));
        }
コード例 #3
0
        public ResultViewModel <SubCategory> Post(SubCategoryEditViewModel SubCategory)
        {
            ResultViewModel <SubCategory> result
                = new ResultViewModel <SubCategory>();

            try
            {
                if (!ModelState.IsValid)
                {
                    result.Message = "In Valid Model State";
                }
                else
                {
                    SubCategory selectedSubCategory
                        = subCategoryService.Add(SubCategory);

                    result.Successed = true;
                    result.Data      = selectedSubCategory;
                }
            }
            catch (Exception ex)
            {
                result.Successed = false;
                result.Message   = "Semething Went Wrong";
            }
            return(result);
        }
コード例 #4
0
        public ActionResult Create(SubCategory subCategory)
        {
            try
            {
                subCategoryService.Add(subCategory);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
コード例 #5
0
 public void Add(SubCategory subCategory)
 {
     subCategoryService.Add(subCategory);
     //return RedirectToAction("Index");
 }
コード例 #6
0
 public ActionResult Add(SubCategory subCategory)
 {
     subCategory.ID = Guid.NewGuid();
     SubCategoryService.Add(subCategory);
     return(RedirectToAction("List"));
 }
コード例 #7
0
 public ActionResult Add(SubCategory model)
 {
     _subcategoryService.Add(model);
     return(View(_categoryService.GetActive()));
 }
コード例 #8
0
 public ActionResult Add(SubCategory data)
 {
     _subCategoryService.Add(data);
     return(Redirect("/Admin/SubCategory/List"));
 }
コード例 #9
0
 public ActionResult AddSubCategory(SubCategory subCategory, int categoryId)
 {
     subCategory.CategoryId = categoryId;
     subCategoryService.Add(subCategory);
     return(RedirectToAction("Index"));
 }