示例#1
0
        public void SellArticle(SupplierArticle article, int buyerId)
        {
            if (article == null)
            {
                throw new Exception("Could not order article");
            }

            _logger.Debug("Trying to sell article with id=" + article.Id);

            ArticleSale sale = new ArticleSale()
            {
                ArticleId = article.Id,
                BuyerId   = buyerId,
                Date      = DateTime.Now
            };

            try
            {
                _articleRepository.AddArticleSale(sale);
                _logger.Info("Article with id=" + article.Id + " is sold.");
            }
            catch (ArgumentNullException ex)
            {
                _logger.Error("Could not save article with id=" + article.Id);
                throw new Exception("Could not save article with id");
            }
            catch (Exception)
            {
            }
        }