public ConfiguringProduct CreateConfiguringProduct(ConfiguringProduct configuringProduct)
        {
            _context.ConfiguringProducts.Add(configuringProduct);
            _context.SaveChanges();

            return(configuringProduct);
        }
예제 #2
0
        public ConfiguringProduct CreateConfiguringProduct(ConfiguringProduct configuringProduct)
        {
            if (configuringProduct.MakeProductId != null)
            {
                var makeProduct = _makeProductRepository.
                                  GetMakeProduct(configuringProduct.MakeProductId);
                if (makeProduct.ConfiguringProduct != null)
                {
                    throw new Exception();
                }
                configuringProduct.MakeProduct = makeProduct;
            }
            else
            {
                throw new ArgumentException($"Please, enter ID Make Product ");
            }

            if (configuringProduct.AuthorId != null)
            {
                configuringProduct.Author = _authorRepository
                                            .GetAuthor(configuringProduct.AuthorId.Value);
            }

            return(_configuringProductRepository.CreateConfiguringProduct(configuringProduct));
        }
        public ConfiguringProduct GetConfiguringProduct(int id)
        {
            ConfiguringProduct configuringProduct = _context.ConfiguringProducts
                                                    .Include(a => a.MobileTestingProduct)
                                                    .Where(a => a.Id.Equals(id))
                                                    .SingleOrDefault();

            return(configuringProduct);
        }
예제 #4
0
 public ConfiguringProduct CreateConfiguringProduct(ConfiguringProduct configuringProduct)
 {
     return(_configuringProductService.CreateConfiguringProduct(configuringProduct));
 }