예제 #1
0
        public IResult Update(Products instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException();
            }

            IResult result = new Result(false);
            try
            {
                this._repository.Update(instance);
                result.Success = true;
            }
            catch (Exception ex)
            {
                result.Exception = ex;
            }
            return result;
        }
예제 #2
0
        public ActionResult Edit(Products products, string category)
        {
            if (ModelState.IsValid)
            {
                this._productService.Update(products);
                return RedirectToAction("Index", new { category = category });
            }
            
            ViewBag.CategoryID = new SelectList(this.Categories, "CategoryID", "CategoryName", products.CategoryID);
 
            return View(products);
        }