コード例 #1
0
        public ActionResult DeleteExtProduct(ExtProductModel extProduct)
        {
            var session = new ExtProductSessionManager(HttpContext);

            session.DeleteExtProduct(extProduct);
            return(RedirectToAction(nameof(ExtProductList)));
        }
コード例 #2
0
        public List <ExtProductModel> AddExtProduct(ExtProductModel extProduct)
        {
            var extnProducts = GetOrCreateExtProductList();

            extProduct.Id = extnProducts.Count > 0 ? extnProducts.Max(x => x.Id) + 1 : 1;
            extnProducts.Add(extProduct);
            return(extnProducts);
        }
コード例 #3
0
        public List <ExtProductModel> DeleteExtProduct(ExtProductModel extProduct)
        {
            var extProducts = GetOrCreateExtProductList();
            var queryDelete = extProducts
                              .Where(x => x.Id == extProduct.Id)
                              .FirstOrDefault();

            extProducts.Remove(queryDelete);
            return(extProducts);
        }
コード例 #4
0
 public ActionResult EditExtProduct(ExtProductModel extProduct)
 {
     if (ModelState.IsValid)
     {
         var session = new ExtProductSessionManager(HttpContext);
         session.EditExtProduct(extProduct);
         return(RedirectToAction(nameof(ExtProductList)));
     }
     return(View(extProduct));
 }
コード例 #5
0
        public ExtProductModel EditExtProduct(ExtProductModel extProduct)
        {
            var editExtProduct = GetOrCreateExtProductList()
                                 .Where(x => x.Id == extProduct.Id)
                                 .FirstOrDefault();

            editExtProduct.Name      = extProduct.Name;
            editExtProduct.Quantity  = extProduct.Quantity;
            editExtProduct.MassUnits = extProduct.MassUnits;
            return(editExtProduct);
        }