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));
        }
Example #2
0
 public MakeProduct GetMakeProduct(string id)
 {
     return(_makeProductRepository.GetMakeProduct(id));
 }