Skip to content

Instantly share code, notes, and snippets.

@bernardobrezende
Forked from anonymous/gist:4483415
Last active December 10, 2015 19:48
Show Gist options
  • Save bernardobrezende/4483451 to your computer and use it in GitHub Desktop.
Save bernardobrezende/4483451 to your computer and use it in GitHub Desktop.
public class NotaFiscal : Entidade
{
private IList<Item> itens;
public virtual IEnumerable<Item> Itens { get { return this.itens; } }
public virtual string Descricao { get; set; }
public virtual decimal ValorTotal { get; protected set; }
protected NotaFiscal() { }
public NotaFiscal(string descricao)
{
// TODO: validações para construção
this.Descricao = descricao;
}
public virtual void AdicionarItem(Item item)
{
if (item != null)
{
this.itens.Add(item);
this.ValorTotal += item.Valor;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment