Beispiel #1
0
        //-> SelectByID
        public async Task <AccountViewDTO> SelectByID(int id)
        {
            var account = await db.tblAccounts.FirstOrDefaultAsync(a => a.acct_Deleted == null && a.acct_AccountID == id);

            if (account == null)
            {
                throw new HttpException((int)HttpStatusCode.NotFound, "NotFound");
            }

            var accountView = DoubleHelper.TwoPrecision(MappingHelper.MapDBClassToDTO <tblAccount, AccountViewDTO>(account));

            accountView.statusCaption = SelectionHelper.AccountStatusCaption(account.acct_Status);
            accountView.documents     = DocumentHelper.GetDocuments(db, ConstantHelper.TABLE_ACCOUNT_ID, account.acct_AccountID);
            return(accountView);
        }