Example #1
0
        private AccountDto BuildAccountDto()
        {
            AccountDto dto = new AccountDto()
            {
                AccountKind = AccountTypeOption.GetValue(Account.DEFAULT_ACCOUNT_KIND),
                Description = DescriptionOption.GetValue(String.Empty),
                Name        = AccountName.GetValue(String.Empty),
                Priority    = PriorityOption.GetValue(Account.DEFAULT_PRIORITY)
            };

            if (CategoryNameOption.IsDataValid)
            {
                dto.CategoryId = Repositories.AccountRepository.GetIdByName(CategoryNameOption.GetValue(null));
            }
            else
            {
                dto.CategoryId = null;
            }

            if (AccountId.IsDataValid)
            {
                dto.Id = AccountId.GetValue(-1);
            }
            else
            {
                dto.Id = null;
            }

            return(dto);
        }