Esempio n. 1
0
        public async Task <IActionResult> PutProductMst(int id, ProductMst productMst)
        {
            if (id != productMst.ProductId)
            {
                return(BadRequest());
            }

            _context.Entry(productMst).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProductMstExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <ActionResult <ProductMst> > PostProductMst(ProductMst productMst)
        {
            _context.CarMaker.Add(productMst);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetProductMst", new { id = productMst.ProductId }, productMst));
        }
        public JsonResult CalculatePrice(int selectedProductId, double countOrWeight)
        {
            ProductMst product = _db.ProductMsts.FirstOrDefault(a => a.pk_ProductId == selectedProductId);
            double     price   = countOrWeight * product.sellingUpToPrice;

            return(Json(price, JsonRequestBehavior.AllowGet));
        }
        public JsonResult getItemUnitPrice(int itemId)
        {
            ProductMst product    = _db.ProductMsts.FirstOrDefault(a => a.pk_ProductId == itemId);
            double     UnitePrice = product.oriPrice;

            return(Json(product, JsonRequestBehavior.AllowGet));
        }
        public ActionResult DeleteConfirmed(string id)
        {
            ProductMst productMst = db.ProductMsts.Find(id);

            db.ProductMsts.Remove(productMst);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public JsonResult CalculatePrice(int selectedProductId, double quantity)
        {
            ProductMst product = db.ProductMsts.FirstOrDefault(s => s.pk_ProductId == selectedProductId);

            double price = quantity * product.SellingUptoPrice;

            return(Json(price, JsonRequestBehavior.AllowGet));
        }
 public ActionResult Edit([Bind(Include = "prodId,prodType")] ProductMst productMst)
 {
     if (ModelState.IsValid)
     {
         db.Entry(productMst).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(productMst));
 }
        public ActionResult Create([Bind(Include = "prodId,prodType")] ProductMst productMst)
        {
            if (ModelState.IsValid)
            {
                db.ProductMsts.Add(productMst);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(productMst));
        }
        // GET: Admin/ProductMsts/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProductMst productMst = db.ProductMsts.Find(id);

            if (productMst == null)
            {
                return(HttpNotFound());
            }
            return(View(productMst));
        }