Exemplo n.º 1
0
        public ActionResult Update(SubCategory item, HttpPostedFileBase resim)
        {
            ViewBag.CategoryID = new SelectList(cs.GetActive(), "ID", "CategoryName", item.CategoryID);
            SubCategory gelen = ss.GetByID(item.ID);

            gelen.SubCategoryName = item.SubCategoryName;
            gelen.CategoryID      = item.CategoryID;
            gelen.Description     = item.Description;
            if (resim != null)
            {
                bool   result;
                string fileResult = FxFunction.ImageUpload(resim, ImageFile.SubCategories, out result);
                if (result)
                {
                    gelen.ImagePath = fileResult;
                }
                else
                {
                    ViewBag.Message = fileResult;
                }
            }
            bool sonuc = ss.Update(gelen);

            if (sonuc)
            {
                ViewBag.Message = "Güncelleme Başarılı";
                return(RedirectToAction("Index", new { id = item.CategoryID }));
            }
            else
            {
                ViewBag.Message = "Güncelleme Başarısız";
            }
            return(View());
        }
        public ResultViewModel <SubCategoryEditViewModel> Update(SubCategoryEditViewModel SubCategory)
        {
            ResultViewModel <SubCategoryEditViewModel> result
                = new ResultViewModel <SubCategoryEditViewModel>();

            try
            {
                if (!ModelState.IsValid)
                {
                    result.Message = "In Valid Model State";
                }
                else
                {
                    SubCategoryEditViewModel selectedSubCategory
                        = subCategoryService.Update(SubCategory);
                    result.Successed = true;
                    result.Data      = selectedSubCategory;
                }
            }
            catch (Exception ex)
            {
                result.Successed = false;
                result.Message   = "Semething Went Wrong";
            }
            return(result);
        }
Exemplo n.º 3
0
        public ActionResult Update(SubCategoryDTO data)
        {
            SubCategory sub = _subCategoryService.GetById(data.ID);

            sub.Name        = data.Name;
            sub.Description = data.Description;
            sub.CategoryID  = data.CategoryID;
            _subCategoryService.Update(sub);

            return(Redirect("/Admin/SubCategory/List"));
        }
Exemplo n.º 4
0
        public ActionResult Edit(SubCategory subCategory)
        {
            try
            {
                subCategoryService.Update(subCategory);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 5
0
        public ActionResult Update(Product product, SubCategory subc)
        {
            Product     pr = productService.GetById(product.ID);
            SubCategory sc = subCategoryService.GetById(subc.ID);

            pr.ID           = product.ID;
            pr.Name         = product.Name;
            pr.Price        = product.Price;
            pr.UnitsInStock = product.UnitsInStock;
            sc.ID           = subc.ID;
            subCategoryService.Update(sc);
            productService.Update(pr);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 6
0
 public ActionResult Edit(SubCategory subCategory)
 {
     SubCategoryService.Update(subCategory);
     return(RedirectToAction("List"));
 }
Exemplo n.º 7
0
 public ActionResult Update(SubCategory model)
 {
     sub.Update(model);
     return(RedirectToAction("Index"));
 }
 public ActionResult Update(SubCategory model)
 {
     _subcategoryService.Update(model);
     return(RedirectToAction("Index", "SubCategory"));
 }