public ActionResult Edit([Bind(Include = "WorkingStandardId,WorkingStandardName,IdCode,MaxxamId,ExpiryDate")] WorkingStandardEditViewModel workingStandard)
        {
            if (ModelState.IsValid)
            {
                InventoryItemRepository inventoryRepo = _uow.InventoryItemRepository;
                var user = _uow.GetCurrentUser();

                InventoryItem invItem = inventoryRepo.Get()
                                        .Where(item => item.WorkingStandard != null && item.WorkingStandard.WorkingStandardId == workingStandard.WorkingStandardId)
                                        .FirstOrDefault();

                WorkingStandard updateStandard = invItem.WorkingStandard;
                updateStandard.IdCode = workingStandard.IdCode;
                updateStandard.WorkingStandardName = workingStandard.WorkingStandardName;
                updateStandard.LastModifiedBy      = user.UserName;
                updateStandard.DateModified        = DateTime.Today;
                updateStandard.ExpiryDate          = workingStandard.ExpiryDate;

                _uow.WorkingStandardRepository.Update(updateStandard);
                //_uow.Commit();

                return(RedirectToAction("Index"));
            }
            return(View(workingStandard));
        }
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WorkingStandard Workingstandard = _uow.WorkingStandardRepository.Get(id);

            if (Workingstandard == null)
            {
                return(HttpNotFound());
            }

            WorkingStandardEditViewModel model = new WorkingStandardEditViewModel()
            {
                WorkingStandardId   = Workingstandard.WorkingStandardId,
                IdCode              = Workingstandard.IdCode,
                WorkingStandardName = Workingstandard.WorkingStandardName
            };

            foreach (var item in Workingstandard.InventoryItems)
            {
                if (item.WorkingStandard.WorkingStandardId == model.WorkingStandardId)
                {
                    model.ExpiryDate = item.WorkingStandard.ExpiryDate;
                }
            }
            return(View(model));
        }