public KnockoutBootStrap.Core.ViewModels.InventoryViewModel SaveInventoryViewModel(KnockoutBootStrap.Core.ViewModels.InventoryViewModel newInventory)
        {
            KnockoutBootStrap.Core.Inventory obj = new Inventory();
            KnockoutBootStrap.Core.ViewModels.InventoryViewModel objnew = new ViewModels.InventoryViewModel();
            using (KnockoutBootStrap.Core.KnockoutBootStrapcoreDataContext dbContext = new KnockoutBootStrapcoreDataContext(Common.ConnString))
            {
                if (newInventory.UpdateCase == "UpdateCase")
                {
                    KnockoutBootStrap.Core.Inventory existingContract = dbContext.Inventories.SingleOrDefault(m => m.Id == newInventory.Id);
                    existingContract.ItemName = newInventory.ItemName;
                    existingContract.ReorderPoint = newInventory.ReorderPoint;
                    dbContext.SubmitChanges();

                }
                else
                {
                    obj.ItemName = newInventory.ItemName;
                    obj.ReorderPoint = newInventory.ReorderPoint;
                    obj.CreatedDate = DateTime.UtcNow;
                    dbContext.Inventories.InsertOnSubmit(obj);
                    dbContext.SubmitChanges();

                }
            }

            return objnew;
        }
        public ActionResult Post(KnockoutBootStrap.Core.ViewModels.InventoryViewModel newInventory)
        {
            if (newInventory.ItemName != null)
            {
                KnockoutBootStrap.Core.Services.InventoryDataService obj = new InventoryDataService();
                var dataitem = obj.SaveInventoryViewModel(newInventory);
                var objInventory = obj.GetContractList();
                return Json(objInventory.ToList(), JsonRequestBehavior.AllowGet);
            }
            else
            {
                return Json("");

            }
        }
        public KnockoutBootStrap.Core.ViewModels.InventoryViewModel UpdateInventoryViewModel(int id, KnockoutBootStrap.Core.ViewModels.InventoryViewModel newInventory)
        {
            KnockoutBootStrap.Core.Inventory obj = new Inventory();
            KnockoutBootStrap.Core.ViewModels.InventoryViewModel objnew = new ViewModels.InventoryViewModel();
            using (KnockoutBootStrap.Core.KnockoutBootStrapcoreDataContext dbContext = new KnockoutBootStrapcoreDataContext(Common.ConnString))
            {
                obj = dbContext.Inventories.Where(x => x.Id == id).SingleOrDefault();
                obj.ItemName = newInventory.ItemName;
                obj.ReorderPoint = newInventory.ReorderPoint;
                obj.CreatedDate = DateTime.UtcNow;
                dbContext.SubmitChanges();

            }
            objnew.CreatedDate = obj.CreatedDate;
            objnew.Id = obj.Id;
            objnew.ItemName = obj.ItemName;
            objnew.ReorderPoint = obj.ReorderPoint;
            return objnew;
        }