Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Productc productc = _productService.FindById(id);

            _productService.DeleteProduct(productc);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
 public bool DeleteProduct(Productc product)
 {
     if (product == null)
     {
         return(false);
     }
     _unitOfWork.ProductcRepository.Delete(product);
     _unitOfWork.Save();
     return(true);
 }
Exemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "ProductcId,ProductName,ProductDescription,Model,UnitOfMeasure,UnitCost,UnitPrice,CategoryId")] Productc productc)
 {
     if (ModelState.IsValid)
     {
         if (_productService.EditProduct(productc))
         {
             return(RedirectToAction("Index"));
         }
     }
     ViewBag.CategoryId = new SelectList(_categoryService.GetAllCategories(), "CategoryId", "CategoryName", productc.CategoryId);
     return(View(productc));
 }
Exemplo n.º 4
0
        // GET: Productcs/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Productc productc = _productService.FindById(id.Value);

            if (productc == null)
            {
                return(HttpNotFound());
            }
            return(View(productc));
        }
Exemplo n.º 5
0
        // GET: Productcs/Edit/5
        public ActionResult Edit(string id)
        {
            if (id.IsEmpty())
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Productc productc = _productService.FindBy(x => x.ProductcId == id).SingleOrDefault();

            if (productc == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CategoryId = new SelectList(_categoryService.GetAllCategories(), "CategoryId", "CategoryName", productc.CategoryId);
            return(View(productc));
        }
Exemplo n.º 6
0
        // GET: Productcs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Productc productc = _productService.FindById(id.Value);

            if (productc == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CategoryId = new SelectList(_categoryService.GetAllCategories(), "CategoryId", "CategoryName", productc.CategoryId);
            return(View(productc));
        }
Exemplo n.º 7
0
 public bool EditProduct(Productc product)
 {
     _unitOfWork.ProductcRepository.Edit(product);
     _unitOfWork.Save();
     return(true);
 }
Exemplo n.º 8
0
 public bool AddProduct(Productc product)
 {
     _unitOfWork.ProductcRepository.Add(product);
     _unitOfWork.Save();
     return(true);
 }