Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created April 20, 2023 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/755579e3fe0d056996027dff4ff24527 to your computer and use it in GitHub Desktop.
Save bjoerntx/755579e3fe0d056996027dff4ff24527 to your computer and use it in GitHub Desktop.
public class Invoice {
public Buyer Buyer { get; set; }
public List<LineItem> LineItems { get; set; }
public float Total {
get {
var total = 0F;
foreach (var item in LineItems) {
total += item.LineTotal;
}
return total;
}
}
}
public class LineItem {
public string ProductID { get; set; }
public string Name { get; set; }
public int Quantity { get; set; }
public float Price { get; set; }
public float LineTotal {
get { return Price * Quantity; }
}
}
public class Buyer {
public string Name { get; set; }
public string ContactName { get; set; }
public string Street { get; set; }
public string City { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment