Esempio n. 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;
        }
Esempio n. 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);
        }