protected override void SaveSpecificAccountDto(AccountDto accountDto) { var jsonAccounts = GetJsonAccounts(); jsonAccounts.Accounts[accountDto.Id] = JsonConvert.SerializeObject(accountDto); lock (this) { _serializedJsonAccounts = JsonConvert.SerializeObject(jsonAccounts); _configuration.Persist(_serializedJsonAccounts); } }
protected override void SaveSpecificAccountDto(AccountDto accountDto) { if (_accountDtos.ContainsKey(accountDto.Id) && _accountDtos[accountDto.Id] != null && _accountDtos[accountDto.Id].Equals(accountDto)) { return; } accountDto.LastChangedUtc = DateTime.UtcNow; _accountDtos[accountDto.Id] = accountDto; }
public async Task <IHttpActionResult> CreateAsync(AccountDto accountDto) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var result = await accountbusiness.CreateAsync(accountDto); if (result != null) { return(Content(HttpStatusCode.OK, result)); } return(Content(HttpStatusCode.InternalServerError, "Error")); }
public string create(AccountDto accountDto) { try { Account accountNew = mapper.Map <AccountDto, Account>(accountDto); accountNew.CreateDate = DateTime.Now; _context.Account.Add(accountNew); _context.SaveChanges(); return("0"); } catch (Exception) { return("1"); } }
public async Task Setup() { _password = RandomData.String; _account = AccountBuilder.Verified() .WithResetToken(RandomData.String) .WithResetTokenExpiry(DateTime.UtcNow.AddDays(3)) .Build(); _response = await Client.PostObject("/accounts/reset-password", new ResetPasswordRequest() { Token = _account.ResetToken, Password = _password }); }
private void BtnDeleteAccount_Click(object sender, RoutedEventArgs e) { AccountDto accountDto = GetClickedAccount(sender); try { _accountRepo.Delete(accountDto.Id); } catch { MessageBox.Show("Unable to delete account. It has been used for other transactions."); } InitializeAccounts(); }
public void AddLikesToNewAccounts(AccountDto dto) { if (dto.Likes == null) { return; } var id = dto.Id; _inMemory.Accounts[id].AddLikesFromToNewAccount(dto.Likes.Select(x => x.Id).ToArray()); foreach (var like in dto.Likes) { _inMemory.Accounts[like.Id].AddLikeTo(id, like.TimeStamp); } }
public IActionResult OnGet(string username) { if (username == null) { return(NotFound()); } Account = _context.GetAccount(username ?? default(string)); if (Account == null) { return(NotFound()); } return(Page()); }
public async Task <IHttpActionResult> UpdateAsync(int id, AccountDto account) { var accountInDb = await _accountRepository.GetAsync(id); if (accountInDb == null) { return(NotFound()); } _accountRepository.Add(account.Map <Account>()); await UnitOfWork.CompleteAsync(); return(Ok()); }
public async Task <ActionResult <AccountDto> > GetCurrentUser() { var accId = Request.Headers["accountid"].ToString(); var user = await _accountRepository.GetAccountById(Convert.ToInt32(accId)); var userDto = new AccountDto { AccountId = user.Id, Email = user.Email, UserName = user.UserName, Token = _tokenService.CreateToken(user.Email, user.Password) }; return(Ok(userDto)); }
public async Task <IActionResult> CreateAccount(AccountDto accDto) { var account = _mapper.Map <Account>(accDto); account.CreatedOn = DateTime.Now; account.ModifiedOn = account.CreatedOn; _repo.Add(account); if (await _repo.SaveAll()) { var accountToReturn = _mapper.Map <AccountDto>(account); return(Ok(accountToReturn)); } return(BadRequest("Failed to create Account!")); }
void IAccountProvider.UpdateAccount(AccountDto account) { const string sql = @" UPDATE `account` SET name = @name, `type` = @type WHERE tenant = @tenant AND id = @id; " ; m_dataRepository.Execute( sql, account ); }
public void GetById() { // Arrange var mock = new Mock <IAccountService>(); AccountDto user = new AccountDto(); user.Id = 1; mock.Setup(AccountService => AccountService.GetById(user.Id)).Returns(user); // Act AccountDto result = mock.Object.GetById(user.Id); // Assert Assert.AreEqual(user.Id, result.Id); }
public void GetByName() { // Arrange var mock = new Mock <IAccountService>(); AccountDto user = new AccountDto(); user.Name = "test"; mock.Setup(AccountService => AccountService.GetByName(user.Name)).Returns(user); // Act AccountDto result = mock.Object.GetByName(user.Name); // Assert Assert.AreEqual(user.Name, result.Name); }
public string BuildJwtToken(AccountDto acct) { var claims = CreateClaims(acct); var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_jwtOptions.Key)); var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); var token = new JwtSecurityToken(_jwtOptions.Issuer, _jwtOptions.Issuer, claims, expires: DateTime.Now.AddMinutes(_jwtOptions.TokenLifetimeMinutes), signingCredentials: creds); return(new JwtSecurityTokenHandler().WriteToken(token)); }
public IActionResult Edit(AccountDto model) { if (!ModelState.IsValid) { return(View()); } var account = _accountRepository.GetAccount(model.AccountId, GetCurrentUser()); account.Name = model.Name; account.InitialBalance = model.InitialBalance; _accountRepository.Update(account); return(RedirectToAction("Index")); }
public async Task <AccountDto> CreateAsync(AccountDto accountDto) { try { accountDto.Password = Extensions.MD5Encrypt(accountDto.Password); accountDto.Status = true; var result = await _iaccountdata.CreateAsync(accountDto); return(result); } catch (Exception ex) { return(null); } }
public AccountActionResponse GetMyAccount(BaseRequest request, Guid userID) { AccountDto userAccount = _baseService.GetAccountById(userID, true); List <PasswordDto> passwords = new List <PasswordDto>(); userAccount.Passwords.ForEach(x => passwords.Add(_baseService.GetPassword(x.PasswordId))); userAccount.Passwords = passwords; return(new AccountActionResponse() { Accounts = new List <AccountDto>() { userAccount } }); }
public IActionResult Login([FromBody] AccountDto accountDto) { Account toAdd = Mapper.Map <Account>(accountDto); _accountRepository.Add(toAdd); bool result = _accountRepository.Save(); if (!result) { return(new StatusCodeResult(500)); } return(CreatedAtRoute("GetSingleSession", new { id = toAdd.ID }, Mapper.Map <AccountDto>(toAdd))); }
public async Task <IActionResult> GetAsync([FromRoute] int id) { try { var account = await this.getAccountsUseCase.GetAsync(new AccountId(id)); var dtoAccount = AccountDto.FromDomain(account); return(Ok(dtoAccount)); } catch (NotFoundException <AccountId> ) { return(NotFound()); } }
public async Task <ActionResult <AccountDto> > PostAccounts(AccountDto accountDto) { try { Account account = new Account { UserId = accountDto.UserId, User = _context.Users.Single(e => e.Id == accountDto.UserId), BranchId = accountDto.BranchId, Branch = _context.Branchs.Single(e => e.Id == accountDto.BranchId), Balance = accountDto.Balance }; _context.Accounts.Add(account); await _context.SaveChangesAsync(); return(await GetAccounts(account.Id)); } catch (InvalidOperationException) { return(BadRequest()); } }
public void TestAccountAddFromDtoConstructor() { using (var testDbInfo = SetupUtil.CreateTestDb()) { //Arrange Mock <ILog> mockLog = new Mock <ILog>(); AccountRepository repo = new AccountRepository(testDbInfo.ConnectionString, mockLog.Object); AccountDto categoryDto = new AccountDto() { Name = "Test Category", AccountKind = Data.Enums.AccountKind.Category, CategoryId = null, Description = "", Priority = 3 }; repo.Upsert(categoryDto); AccountDto accountDto = new AccountDto() { Name = "Test Account", AccountKind = Data.Enums.AccountKind.Source, CategoryId = categoryDto.Id, Description = "", Priority = 7 }; repo.Upsert(accountDto); RepositoryBag repositories = SetupUtil.CreateMockRepositoryBag(testDbInfo.ConnectionString, mockLog.Object, repo); //Act Account account = new Account(accountDto.Id.Value, accountDto.Name, accountDto.CategoryId, accountDto.Priority, accountDto.AccountKind, accountDto.Description, DateTime.Today, repositories); Account category = account.Category; //Assert Assert.Equal("Test Account", account.Name); Assert.Equal(categoryDto.Id, account.CategoryId); Assert.Equal(7, account.Priority); Assert.Equal(Data.Enums.AccountKind.Source, account.AccountKind); Assert.Equal("Test Category", category.Name); Assert.Null(category.CategoryId); Assert.Equal(3, category.Priority); Assert.Equal(Data.Enums.AccountKind.Category, category.AccountKind); } }
public async Task <IActionResult> Account([FromBody] AccountDto accountDto) { var transaction = await _context.Database.BeginTransactionAsync(); try { Receipt receipt = new Receipt() { IsPay = accountDto.IsPay, About = accountDto.About, CreatedBy = AuthoticateUserName(), ClientId = accountDto.ClinetId, Date = DateTime.Now, Amount = accountDto.Amount, Manager = accountDto.Manager, Note = accountDto.Note, }; await this._context.AddAsync(receipt); await this._context.SaveChangesAsync(); var treasuer = await _context.Treasuries.FindAsync(AuthoticateUserId()); treasuer.Total += accountDto.Amount; _context.Update(treasuer); var history = new TreasuryHistory() { Amount = accountDto.Amount, ReceiptId = receipt.Id, TreasuryId = treasuer.Id, CreatedOnUtc = DateTime.Now, }; await _context.AddAsync(history); await _context.SaveChangesAsync(); await transaction.CommitAsync(); return(Ok(receipt.Id)); } catch (Exception ex) { await transaction.RollbackAsync(); return(BadRequest()); } }
public IActionResult SaveUser([FromBody] AccountDto newAccount) { AccountDto accountEmail = null; AccountDto accountUsername = null; if (newAccount.Email != string.Empty) { accountEmail = _accountService.GetAnEmailAccount(newAccount.Email); } if (newAccount.Username != string.Empty) { accountUsername = _accountService.GetAnUsernameAccount(newAccount.Username); } AccountDto accountDto = newAccount; List <ErrorDto> errorsDto = new List <ErrorDto>(); if (accountEmail == null && accountUsername == null) { accountDto = _accountService.SaveAccount(newAccount); } if (accountEmail == null && accountUsername != null) { if (accountUsername.Id == newAccount.Id) { accountDto = _accountService.SaveAccount(newAccount); } else { errorsDto.Add(new ErrorDto("Username", "Данное имя пользователя занято")); } } if (accountEmail != null && accountUsername == null) { if (accountEmail.Id == newAccount.Id) { accountDto = _accountService.SaveAccount(newAccount); } else { errorsDto.Add(new ErrorDto("Email", "Данное email занят")); } } return(Ok(new { account = accountDto, errors = errorsDto })); }
public async Task <IActionResult> Login(AccountDto account) { if (ModelState.IsValid) { var status = await _signInManager.PasswordSignInAsync(account.UserName, account.Password, false, false); if (status == SignInResult.Success) { return(RedirectToAction("Index", "Home", new { area = "" })); } ModelState.AddModelError(string.Empty, "Неверное имя пользователя или пароль"); } return(View(account)); }
public IActionResult UpdatePassword([FromBody] AccountDto dto) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { _accountService.UpdateAccountPassword(dto.id, dto.password); return(Ok()); } catch (Exception ex) { return(BadRequest("Update Failed" + ex.Message)); } }
public void OnRequest(MOBAClient client, byte subCode, OperationRequest request) { switch (subCode) { case OpAccount.Login: AccountDto dto = JsonMapper.ToObject <AccountDto>(request[0].ToString()); OnLogin(client, dto.Account, dto.Password); break; case OpAccount.Register: string account = request[0].ToString(); string password = request[1].ToString(); OnRegister(client, account, password); break; } }
public async Task Setup() { var name = RandomData.String; var password = RandomData.String; _library = LibraryBuilder.Build(); _account = AccountBuilder.InLibrary(_library.Id).AsInvitation().Build(); _response = await Client.PostObject($"/accounts/register/{Guid.NewGuid().ToString("N")}", new RegisterRequest { Name = name, Password = password, AcceptTerms = true }); }
public IActionResult RequestPasswordChange([FromBody] AccountDto dto) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { string confirmation = _accountService.PasswordConfirmation(dto); return(Ok(confirmation)); } catch (Exception ex) { return(BadRequest("Update Failed" + ex.Message)); } }
public async Task <IdentityResult> CreateAsync( AccountDto accountDto, IUserInformationService userInformationService) { var userInformation = new UserInformation(Mapper.Map <AddressDto, Address>(accountDto.AddressDto)); var user = new SportsStoreUser(accountDto.UserName, accountDto.Email, userInformation); var identityResult = await base.CreateAsync(user, accountDto.Password); if (!identityResult.Succeeded) { return(identityResult); } return(await AddToRoleAsync(user.Id, Roles.Customer)); }
public async Task Handle(V1.AccountCreated @event, CancellationToken cancellationToken) { var periodeName = $"{@event.StartDate.ToString("MMMM")} {@event.StartDate.Year}"; var accountDto = new AccountDto( @event.AccountId, @event.OwnerId, periodeName, @event.CurrencyCode, new List <AccountItemDto>(), false, @event.StartDate, @event.EndDate); await accountDtoRepository.Create(accountDto); }
/// <summary> /// GetFakeAccountDtoObject - returns AccountDto /// </summary> /// <returns></returns> public AccountDto GetFakeAccountDtoObject() { var fakeAccountDto = new AccountDto() { AcctContactName = "Test Account", PPVPrivilege = "Capped", PPVCap = "150.00", PPVCapUsed = "0.00", PPVResetDay = "15", PIN = string.Empty }; fakeAccountDto.Location.ID = "9999999"; return fakeAccountDto; }
public bool CreateAccount(AccountDto accountDto, string password) { if (UserExists(accountDto.Username)) { return(false); } byte[] passwordHash, passwordSalt; HashHelper.CreateHash(password, out passwordHash, out passwordSalt); accountDto.PasswordHash = passwordHash; accountDto.PasswordSalt = passwordSalt; var account = accountDto.MappingAccount(); accountRepository.Add(account); return(true); }
public void TestEndLoadAccounts() { //Given WCFAccountService accountService = _mocks.StrictMock<WCFAccountService>(); IAsyncResult result = _mocks.Stub<IAsyncResult>(); CustomerViewModel vm = new CustomerViewModel(); vm.AccountService = accountService; //mock the collection returned by ThirdPartyService AccountDto account = new AccountDto { Balance = 100, BalanceDate = DateTime.Now, Id = 1, Title = "Account 1", Number = "123" }; List<AccountDto> accounts = new List<AccountDto>(); accounts.Add(account); Expect.Call(accountService.EndGetAccountsByCustomer(result)).Return(accounts); _mocks.ReplayAll(); //When vm.EndLoadAccounts(result); Assert.IsFalse(vm.InProgress); Assert.Equals(vm.Accounts.Count, accounts.Count); }
//private void TestWithBothDatastores(Action<IDatastore> test) { // test(GetDatastoreWithFakeData()); // test(GetDatastore()); //} private void TestAccountAndPassword(IDatastore dataStore, AccountDto accountDto) { dataStore.GetAllAccountIds().Should().Contain(id => id.Equals(accountDto.Id)); dataStore.GetAccountDtos().Should().Contain(dataStoreAccountDto => accountDto.Id == dataStoreAccountDto.Id); dataStore.GetAccountDto(accountDto.Id).Equals(accountDto).Should().BeTrue(); dataStore.GetAccountDto(accountDto.Id).IsDeleted.Should().Be(accountDto.IsDeleted); dataStore.GetAccountDto(accountDto.Id).Id.Should().Be(accountDto.Id); dataStore.GetAccountDto(accountDto.Id).LastChangedUtc.Should().Be(accountDto.LastChangedUtc); dataStore.GetAccountDto(accountDto.Id).Notes.Should().Be(accountDto.Notes); dataStore.GetAccountDto(accountDto.Id).ProviderKey.Should().Be(accountDto.ProviderKey); dataStore.GetAccountDto(accountDto.Id).Tags.Should().Equal(accountDto.Tags); dataStore.GetAccountDto(accountDto.Id).Fields.Should().Equal(accountDto.Fields); //dataStore.GetPasswordDtos(accountDto.Id).Should().HaveCount(passwordDtos.Count()); //dataStore.GetPasswordDtos(accountDto.Id).First().Equals(passwordDtos.First()).Should().BeTrue(); //dataStore.GetPasswordDtos(accountDto.Id).Should().Equal(passwordDtos); }
/// <summary> /// GetFakeSubscriberDto - returns SubscriberDto /// </summary> /// <param name="subscriberID"></param> /// <param name="firstName"></param> /// <param name="lastName"></param> /// <param name="subscriberContactPhone"></param> /// <param name="fakeCustomFieldDto"></param> /// <param name="fakeAccountDto"></param> /// <returns></returns> public SubscriberDto GetFakeSubscriberDto(string subscriberID, string firstName, string lastName, string subscriberContactPhone, CustomFieldDto fakeCustomFieldDto, AccountDto fakeAccountDto) { // Build Fake SubscriberDto var fakeSubscriberDto = new SubscriberDto() { ID = subscriberID, Name = string.Format("{0} {1}", firstName, lastName), SubContactPhone = subscriberContactPhone, SubContactEmail = "*****@*****.**", }; fakeSubscriberDto.CustomFields.Add(fakeCustomFieldDto); fakeSubscriberDto.Accounts.Add(fakeAccountDto); return fakeSubscriberDto; }
/// <summary> /// NewSubscriberData - dynamically creates a SubscriberDto /// </summary> /// <returns></returns> public static SubscriberDto NewSubscriberData() { var controlNum = DateTime.Now.ToString("MMddssfff"); controlNum += random.Next(1000, 9999); var sub = new SubscriberDto(); var acct = new AccountDto(); sub.Accounts = new List<AccountDto> { acct }; sub.ID = string.Format("TEST{0}", controlNum); sub.Name = string.Format("{0} NAME", sub.ID); sub.SubContactPhone = DateTime.Now.ToString("hhmmssfff") + random.Next(0, 9); sub.SubContactEmail = string.Format("Test{0}@test.com", controlNum); acct.PIN = controlNum.Substring(6, 4); acct.PinRequired = true; acct.ServiceEnabled = false; acct.PPVEnabled = false; acct.PPVPrivilege = "2"; acct.PPVResetDay = "15"; acct.PPVCap = "150.00"; return sub; }
public AccountViewModel(AccountDto account) : this() { Account = account; }
public void TestTransaction() { Rendu.Clear(); addToOc(ActionsEnum.Travail.ToString(), ServiceEnum.Transaction.ToString()); #region Nouvelle Categorie, Nouveau Account var newCategory = new CategoryDto(); newCategory.Balance = 7.0; newCategory.Color = "AA"; newCategory.Name = "MyCategory"; var newAccount = new AccountDto(); newAccount.Balance = 7.0; newAccount.BankName = "AA"; newAccount.Name = "MyAccount"; #endregion #region Nettoyage Base var Categories = CategoryService.GetAllCategories(false, false); addToOc(ActionsEnum.GetList.ToString(), string.Format(TEMPLATEMessagedifferService, ServiceEnum.Category.ToString(), ObjectType.itemCount.ToString(), Categories.Value.Count)); var Accounts = AccountService.GetAllAccounts(false, false); addToOc(ActionsEnum.GetList.ToString(), string.Format(TEMPLATEMessagedifferService, ServiceEnum.Account.ToString(), ObjectType.itemCount.ToString(), Accounts.Value.Count)); if (Categories.Value.Count > 0) { foreach (var dto in Categories.Value) { CategoryService.DeleteCategorieById(dto.Id); addToOc(ActionsEnum.Delete.ToString(), string.Format(TEMPLATEMessagedifferService, ServiceEnum.Category.ToString(), ObjectType.itemId.ToString(), dto.Id)); } Categories = CategoryService.GetAllCategories(false, false); addToOc(ActionsEnum.GetList.ToString(), string.Format(TEMPLATEMessagedifferService, ServiceEnum.Category.ToString(), ObjectType.itemCount.ToString(), Categories.Value.Count)); } if (Accounts.Value.Count > 0) { foreach (var dto in Accounts.Value) { AccountService.DeleteAccountById(dto.Id); addToOc(ActionsEnum.Delete.ToString(), string.Format(TEMPLATEMessagedifferService, ServiceEnum.Account.ToString(), ObjectType.itemId.ToString(), dto.Id)); } Accounts = AccountService.GetAllAccounts(false, false); addToOc(ActionsEnum.GetList.ToString(), string.Format(TEMPLATEMessagedifferService, ServiceEnum.Account.ToString(), ObjectType.itemCount.ToString(), Accounts.Value.Count)); } #endregion #region Ajout Category, Account var addedCategory = CategoryService.CreateCategory(newCategory); addToOc(ActionsEnum.Insert.ToString(), string.Format(TEMPLATEMessagedifferService, ServiceEnum.Category.ToString(), ObjectType.itemId.ToString(), addedCategory.Value.Id)); var addedAccount = AccountService.CreateAccount(newAccount); addToOc(ActionsEnum.Insert.ToString(), string.Format(TEMPLATEMessagedifferService, ServiceEnum.Account.ToString(), ObjectType.itemId.ToString(), addedAccount.Value.Id)); #endregion #region Ajout 2 transactions, same account, 1 with the category var newTransaction = new TransactionDto(); newTransaction.Name = "First Transaction !"; newTransaction.Balance = 40.0; newTransaction.Account = addedAccount.Value; newTransaction.Category = addedCategory.Value; var newTransaction2 = new TransactionDto(); newTransaction2.Name = "Second Transaction !"; newTransaction2.Balance = 40.0; newTransaction2.Account = addedAccount.Value; var addedtransaction = TransactionService.CreateTransaction(newTransaction); addToOc(ActionsEnum.Insert.ToString(), string.Format(TEMPLATEMessagedifferService, ServiceEnum.Transaction.ToString(), ObjectType.itemName.ToString(), addedtransaction.Value.Name)); var addedtransaction2 = TransactionService.CreateTransaction(newTransaction); addToOc(ActionsEnum.Insert.ToString(), string.Format(TEMPLATEMessagedifferService, ServiceEnum.Transaction.ToString(), ObjectType.itemName.ToString(), addedtransaction2.Value.Name)); #endregion #region get des listes par account et par category var listebyAccount = TransactionService.GetTransactionsByAccountId(addedAccount.Value.Id, false, false); addToOc(ActionsEnum.GetList.ToString(), string.Format(TEMPLATEMessagedifferService, ServiceEnum.Transaction.ToString(), ObjectType.itemCount.ToString(), listebyAccount.Value.Count)); var listebyCategory = TransactionService.GetTransactionsByCategoryId(addedCategory.Value.Id, false, false); addToOc(ActionsEnum.GetList.ToString(), string.Format(TEMPLATEMessagedifferService, ServiceEnum.Transaction.ToString(), ObjectType.itemCount.ToString(), listebyCategory.Value.Count)); #endregion var gettedTrans = TransactionService.GetTransactionById(addedtransaction.Value.Id, false, false).Value; addToOc(ActionsEnum.Get.ToString(), string.Format(TEMPLATEMessagedifferService, ServiceEnum.Transaction.ToString(), ObjectType.itemName.ToString(), gettedTrans.Name)); gettedTrans.Name = "MODIFIED"; var updatedCategory = TransactionService.UpdateTransaction(gettedTrans); addToOc(ActionsEnum.Update.ToString(), string.Format(TEMPLATEMessageOnUpdate, ServiceEnum.Transaction.ToString(), ObjectType.itemName.ToString(), updatedCategory.Value.Name, addedtransaction.Value.Name)); }
public void TestAccount() { Rendu.Clear(); addToOc(ActionsEnum.Travail.ToString(), ServiceEnum.Account.ToString()); var item = new AccountDto(); item.Balance = 7.0; item.BankName = "AA"; item.Name = "Mon Compte 2"; var Accounts = AccountService.GetAllAccounts(false, false); addToOc(ActionsEnum.GetList.ToString(), string.Format(TEMPLATEMessage,ObjectType.itemCount.ToString(), Accounts.Value.Count.ToString())); if (Accounts.Value.Count > 0) { foreach (var dto in Accounts.Value) { AccountService.DeleteAccountById(dto.Id); addToOc(ActionsEnum.Delete.ToString(), string.Format(TEMPLATEMessage, ObjectType.itemId.ToString(), dto.Id.ToString())); } Accounts = AccountService.GetAllAccounts(false, false); addToOc(ActionsEnum.GetList.ToString(), string.Format(TEMPLATEMessage, ObjectType.itemCount.ToString(), Accounts.Value.Count.ToString())); } var addedaccount = AccountService.CreateAccount(item); addToOc(ActionsEnum.Insert.ToString(),string.Format(TEMPLATEMessage,ObjectType.itemId.ToString(), addedaccount.Value.Id.ToString())); var Account = AccountService.GetAccountById(addedaccount.Value.Id, false, false); addToOc(ActionsEnum.Get.ToString(), string.Format(TEMPLATEMessage, ObjectType.itemId.ToString(), Account.Value.Id)); Account.Value.BankName = "TESTER"; var updatedAccount = AccountService.UpdateAccount(Account.Value); addToOc(ActionsEnum.Update.ToString(), string.Format(TEMPLATEMessageOnUpdate, ServiceEnum.Account.ToString(), ObjectType.itemName.ToString(), updatedAccount.Value.BankName, addedaccount.Value.BankName)); }
protected override void SaveSpecificAccountDto(AccountDto accountDto) { var originalAccountDto = GetAccountDto(accountDto.Id); if (originalAccountDto.Equals(accountDto)) { return; } GetAccountElement(accountDto.Id).Remove(); GetAccountProviderElement(accountDto.Id).Value = accountDto.ProviderKey; foreach (var field in accountDto.Fields) { GetFieldNameElement(accountDto.Id, field.Id).Value = field.Name; GetFieldTypeKeyElement(accountDto.Id, field.Id).Value = field.FieldTypeKey; GetFieldValueElement(accountDto.Id, field.Id).Value = field.Value.ToString(); } foreach (var tag in accountDto.Tags) { GetTagElement(tag.Key, accountDto.Id); } GetNoteElement(accountDto.Id).Value = accountDto.Notes ?? ""; GetAccountDeletedElement(accountDto.Id).Value = accountDto.IsDeleted.ToString(); var accountElement = GetAccountElement(accountDto.Id); UpdateLastChangedUtc(accountElement); SaveXml(); accountDto.LastChangedUtc = GetLastChangedUtc(accountElement); }