Example #1
0
 public string Build(Bracket bracket)
 {
     return(string.Join(
                "\n",
                "Bill",
                string.Join(
                    "\n",
                    bracket.Articles
                    .GroupBy(
                        article => article.Name,
                        article => article,
                        (baseArticle, articles) => new
     {
         Key = baseArticle,
         Quantity = articles.Count(),
         TotalPrice = articles.Sum(article => article.Price)
     }
                        )
                    .Select(
                        groupedArticles =>
                        $"{groupedArticles.Key} - {groupedArticles.Quantity} - {groupedArticles.TotalPrice}€"
                        )
                    ),
                string.Join(
                    "\n",
                    bracket.Transactions
                    .Select(
                        transaction =>
                        $"{transaction.Type} : {transaction.Amount}€"
                        )
                    )
                ));
 }
Example #2
0
 public WebOrder(
     Customer customer,
     DeliveryMode deliveryMode,
     Bracket bracket
     )
 {
     Customer     = customer;
     DeliveryMode = deliveryMode;
     Bracket      = bracket;
 }