Ejemplo n.º 1
0
        public static Account FromDbEntity(SqlEntity.Account account)
        {
            var db = new ApplicationDomainContext();

            var subcategory = db.Select <SqlEntity.Subcategory>().First(s => s.Id == account.SubcategoryId);
            var category    = db.Select <SqlEntity.Category>().First(c => c.Id == account.CategoryId);

            return(FromDbEntity(account, category, subcategory));
        }
Ejemplo n.º 2
0
 public static Account FromDbEntity(SqlEntity.Account account, SqlEntity.Category category, SqlEntity.Subcategory subcategory)
 {
     return(new Account
     {
         Id = account.Id,
         Name = account.Name,
         NormalSide = (NormalSide)account.NormalSide,
         BeginningBalance = account.BeginningBalance,
         Balance = account.Balance,
         Debit = account.Debit,
         Credit = account.Credit,
         Comment = account.Comment,
         Order = account.Order,
         Active = account.Active == 1,
         Category = Category.FromDbEntity(category),
         Subcategory = Subcategory.FromDbEntity(subcategory),
         AccountId = account.AccountId,
         ContraAccount = account.ContraAccount == 1
     });
 }