Пример #1
0
        private void processData(IEnumerable <Specification> specifications, DataOP op, ProjectBrief project)
        {
            if (specifications == null)
            {
                return;
            }



            foreach (var specification in specifications)
            {
                specification.ProjectBriefId = project.Id;
                if (DataOP.AddNew == op)
                {
                    _specificationRepository.Add(specification);
                }
                else if (DataOP.EDIT == op)
                {
                    specification.Item = null;
                    _specificationRepository.Update(specification);
                }
                else if (DataOP.DEL == op)
                {
                    var requestItem = _specificationRepository.GetById(specification.Id);
                    _specificationRepository.Delete(requestItem);
                }
            }
        }
Пример #2
0
        private async void SaveModel()
        {
            try
            {
                if (_updatingPage)
                {
                    PrepareModelForSave();

                    await _specRepo.UpdateAsync(SpecModel);

                    await _specRepo.SaveChangesAsync();

                    TriggerSaveEvent();
                }
                else
                {
                    PrepareModelForSave();

                    _specRepo.Add(SpecModel);
                    await _specRepo.SaveChangesAsync();

                    // Forces the product form and category form to be refreshed the next time they're opened, because the products and categories are dependent on the specifications
                    var window = (NavigationWindow)GetParentWindow();
                    window.ccProductForm.Content  = null;
                    window.ccCategoryForm.Content = null;

                    TriggerSaveEvent();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #3
0
        public async Task Handle(CreateSpecificationCommand command)
        {
            if (await _specificationRepository.GetByLeafCategoryId(command.LeafCategoryId) != null)
            {
                throw new Exception();
            }

            var dimension = SpecificationFactory.CreateSpecificationFrom(command);

            _specificationRepository.Add(dimension);
        }
Пример #4
0
        public IActionResult Add(PDD.Core.Model.Good.Specification gs)
        {
            int i = _specificationRepository.Add(gs);

            return(Ok(i));
        }