namespace Before;
///
/// Consumes and domain objects
/// directly.
///
public class WebApp
{
///
/// Returns the client's name, id, and orders formatted as text.
///
public string ShowClient(Client client)
{
ArgumentNullException.ThrowIfNull(client);
var lines = new List { $"{client.Name} [{client.Id}]" };
foreach (var order in client.Orders)
lines.Add($" - order [{order.Id}]: {order.Description}");
return string.Join(Environment.NewLine, lines);
}
/// Returns true when the client is attached to a context.
public bool IsPersisted(Client client)
{
ArgumentNullException.ThrowIfNull(client);
return client.DbContext is not null;
}
}