public ActionResult UpdateList(List <AssemblyItemVM> assemblyItemList)
        {
            if (assemblyItemList == null)
            {
                throw new Exception("Nothing to save.");
            }

            var result = "success";

            foreach (AssemblyItemVM ai in assemblyItemList)
            {
                _assemblyitemService.Update(ai);
            }

            return(Json(true, JsonRequestBehavior.AllowGet));
        }
        //public JsonResult Update([Bind(Include = "Id,Code,Description,UnitsOfMeasure,QtyOnHand")]AssemblyItemVM revised)
        public JsonResult Update(AssemblyItemDetailVM revised)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var updated = _assemblyitemService.Update(revised);
                    return(Json(new { success = true, model = updated }));
                }
                catch (Exception ex)
                {
                    if (ex.Message.Contains("IX_Code"))
                    {
                        ModelState.AddModelError("Code", "This AssemblyItem Number already exists. Duplicate AssemblyItem Numbers are not allowed.");
                    }
                    else
                    {
                        ModelState.AddModelError(string.Empty, "The save failed.");
                    }
                }
            }

            return(JsonErrorResult());
        }