public ActionResult Edit([Bind(Include = "Id,Name,Code")] Category category)
 {
     if (ModelState.IsValid)
     {
         db.Entry(category).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(category));
 }
Esempio n. 2
0
 public ActionResult Edit([Bind(Include = "Id,Description,StockDate")] StockIn stockIn)
 {
     if (ModelState.IsValid)
     {
         db.Entry(stockIn).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(stockIn));
 }
Esempio n. 3
0
 public ActionResult Edit([Bind(Include = "Id,Name,Code,CategoryId")] Product product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CategoryId = new SelectList(db.Categories, "Id", "Name", product.CategoryId);
     return(View(product));
 }
 public ActionResult Edit([Bind(Include = "Id,ProductId,Qty")] Inventory inventory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(inventory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ProductId = new SelectList(db.Products, "Id", "Name", inventory.ProductId);
     return(View(inventory));
 }
 public ActionResult Edit([Bind(Include = "Id,StockInId,ProductId,Qty")] StockInDetail stockInDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(stockInDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ProductId = new SelectList(db.Products, "Id", "Name", stockInDetail.ProductId);
     ViewBag.StockInId = new SelectList(db.StockIns, "Id", "Description", stockInDetail.StockInId);
     return(View(stockInDetail));
 }
Esempio n. 6
0
        /// <summary>
        /// Disminuye la cantidad del producto con la cantidad informada
        /// </summary>
        /// <param name="product">Información del producto</param>
        /// <returns>Respuesta que información si se realizo la actualización correctamente</returns>
        public ResponseService UpdateAmountProdut(Product product)
        {
            ResponseService response = new ResponseService();

            if (!ProductExists(product.ItemNo))
            {
                response = response.GetIncorrectResponse(10, "The Product Exists");
            }
            else
            {
                var productoBD = _context.Products.Find(product.ItemNo);
                productoBD.Amount = productoBD.Amount - product.Amount;
                _context.Entry(productoBD).State = EntityState.Modified;
                _context.SaveChanges();
                response = response.GetCorrectResponse(null, "The Enterprise updated correctly");
            }

            return(response);
        }
Esempio n. 7
0
 public bool Update(Party party)
 {
     db.Parties.Attach(party);
     db.Entry(party).State = EntityState.Modified;
     return(db.SaveChanges() > 0);
 }
Esempio n. 8
0
 public virtual bool Update(T entity)
 {
     db.Set <T>().Attach(entity);
     db.Entry(entity).State = EntityState.Modified;
     return(db.SaveChanges() > 0);
 }