public async Task <BrandingDetailsWithMasterDto> GetBrandingInfoWithAccountType(int bId, int programId) { using (var sqlConnection = await _databaseConnectionFactory.CreateConnectionAsync()) { try { var brandInfo = new BrandingDetailsWithMasterDto(); var programAccount = _mapper.Map <List <ProgramAccountDto> >(await _programAccount.GetDataAsync(new { IsDeleted = false, ProgramId = programId })); var accountType = _mapper.Map <List <AccountTypeDto> >(await _accountType.GetDataAsync(new { IsDeleted = false })); if (bId > 0) { brandInfo = _mapper.Map <BrandingDetailsWithMasterDto>(await GetDataByIdAsync(new { id = bId, IsActive = true, IsDeleted = false })); brandInfo.accountType = accountType.Where(x => x.Id == brandInfo.accountTypeId).Select(x => x.AccountType).FirstOrDefault(); var ImageBranding = (await _photos.GetDataByIdAsync(new { entityId = brandInfo.id, photoType = PhotoEntityType.BrandingLogo })); if (ImageBranding != null) { brandInfo.ImagePath = await _photos.GetAWSBucketFilUrl(ImageBranding.photoPath, null); brandInfo.ImageFileName = ImageBranding.photoPath; } } else { brandInfo.cardNumber = Cryptography.GetNextInt64().ToString(); } brandInfo.programAccount = programAccount; return(brandInfo); } catch (Exception) { throw; } finally { sqlConnection.Close(); sqlConnection.Dispose(); } } }
public async Task <ProgramAccountDetailsWithMasterDto> GetProgramAccountInfoWithAccountType(int Id) { try { var accInfo = new ProgramAccountDetailsWithMasterDto(); var accountType = _mapper.Map <List <AccountTypeDto> >(await _accountType.GetDataAsync(new { IsDeleted = false })); if (Id > 0) { accInfo = _mapper.Map <ProgramAccountDetailsWithMasterDto>(await GetDataByIdAsync(new { id = Id })); } accInfo.AccountType = accountType; return(accInfo); } catch (Exception) { throw; } }