title: Where to put business logic in DDD that shared between domain layer and presentation layer?
body: <p>I'm developing app using DDD pattern.</p>
  
  <p>I have <code>Invoice</code> class in domain layer.</p>
  
  <pre><code>public class Invoice
  {
      List&lt;InvoiceLine&gt; list = new List&lt;InvoiceLine&gt;();
  
      public DateTime Date { get; set; }
  
      public Customer Customer { get; set; }
  
      public decimal GrandTotal 
      { 
          get
          {
              // Simplified grand total. 
              // It's actually include tax and discount to calculate.
  
              decimal total = 0m;
              foreach(InvoiceLine line in Lines)
                  total += line.LineTotal;
  
              return total;
          }
      }
  
      public IEnumerable&lt;InvoiceLine&gt; Lines
      {
          get { return list; } 
      }
  
      public void AddLine(InvoiceLine line)
      {
          lines.Add(line);
      }
  }
  </code></pre>
  
  <p>I'm using mvvm pattern so i also have a viewmodel to edit invoice. My question is <strong>where should i put the business logic to calculate GrandTotal so that the business logic on domain and presentation is the same ?</strong></p>
  
  <p>Should i just duplicate the code from domain to presentation (<code>Invoice</code> to <code>InvoiceViewModel</code>)? or make a service that both domain and presentation could use?</p>