예제 #1
0
        private void UpdateMaintenanceItemDetail(ModelViewModel model)
        {
            List <MaintenanceItemDetailViewModel> newMaintenaceItems = model.MaintenanceItems;
            var deleteItems =
                _maintenanceItemDetailRepository.GetAll().Where(x => x.ObjectI.Equals(model.ObjectI) && x.ModelC == model.ModelC);

            if (deleteItems.Any())
            {
                foreach (var item in deleteItems)
                {
                    _maintenanceItemDetailRepository.Delete(item);
                }
            }

            //add
            foreach (var item in newMaintenaceItems)
            {
                var addItem = new MaintenanceItem_D()
                {
                    DisplayLineNo    = item.DisplayLineNo,
                    MaintenanceItemC = item.MaintenanceItemC,
                    ModelC           = item.ModelC,
                    ObjectI          = item.ObjectI
                };
                _maintenanceItemDetailRepository.Add(addItem);
            }
        }
예제 #2
0
        public void DeleteItems(string objectI, string modelC)
        {
            var deleteItems =
                _maintenanceItemDetailRepository.GetAll().Where(x => x.ObjectI.Equals(objectI) && x.ModelC == modelC);

            if (deleteItems.Any())
            {
                foreach (var item in deleteItems)
                {
                    _maintenanceItemDetailRepository.Delete(item);
                }

                SaveMaintenanceItem();
            }
        }