private async void DeleteAccount(object param) { var userAccount = param as UserAccount; if (userAccount == null) { return; } var userAccountViewModel = SelectedUserAccountViewModels.FirstOrDefault(a => a.UserAccount.AccountName.Equals(userAccount.AccountName)); if (userAccountViewModel != null) { Close(userAccountViewModel); } try { await accountsService.DeleteAccount(userAccount); Accounts.Remove(userAccount); Module.RemoveAccount(userAccount.AccountName); } catch (Exception ex) { ShowMessage(new Message { MessageType = MessageType.Error, Text = ex.Message }); } }
public IHttpActionResult DeleteAccount(int id) { Account account = accountsService.DeleteAccount(id); if (account == null) { return(NotFound()); } return(Ok(account)); }
public async Task <IActionResult> DeleteAccount(Guid accountId) { _logger.LogInformation("Deleting account with id: " + accountId); var success = await _accountsService.DeleteAccount(accountId); if (success) { _logger.LogInformation("Successfully deleted account with id: " + accountId); return(Ok(true)); } _logger.LogError("Failed to delete account with id: " + accountId); return(new StatusCodeResult(StatusCodes.Status500InternalServerError)); }
private void DeleteAccount(object param) { var userAccount = param as UserAccount; if (userAccount == null) { return; } accountsService.DeleteAccount(userAccount); Accounts.Remove(userAccount); Module.RemoveAccount(userAccount.AccountName); }
public async Task <ActionResult <AccountResponse> > DeleteAccount(Guid id) { var rs = await _accountService.DeleteAccount(id); if (rs == null) { return(NoContent()); } else { return(Ok(rs)); } }
public async Task DeleteAccount_Valid() { var account = await _accountsService.GetAccount(Guid.Parse("760ee42b-bd47-46eb-8fd3-d5d02760dd6c")); Assert.IsTrue(account.IsActive); // Act var success = await _accountsService.DeleteAccount(Guid.Parse("760ee42b-bd47-46eb-8fd3-d5d02760dd6c")); Assert.IsTrue(success); // Should not get account as it is now deleted var deletedAccount = await _accountsService.GetAccount(Guid.Parse("760ee42b-bd47-46eb-8fd3-d5d02760dd6c")); // Assert Assert.IsNull(deletedAccount); }
public async Task <IActionResult> DeleteAccountAsync(string email) { await _accountService.DeleteAccount(email); return(Ok()); }
public void Can_Create_Delete_Account() { var servicePackages = _lookupService.GetServicePackages(); var contactTypes = _lookupService.GetContactTypes().ToList(); var contactMethods = _lookupService.GetContactMethods().ToList(); var paymentMethods = _lookupService.GetPaymentMethods().ToList(); var nvralertTypes = _lookupService.GetNvrAlertTypes().ToList(); var eventGroups = _lookupService.GetEventGroups().ToList(); var analyticAlgorithms = _lookupService.GetAnalyticAlgorithmTypes().ToList(); //step 1 - create account var accountDto = new AccountDto { AccountNumber = "123456789", Name = "Test_Account", ServicePackageId = servicePackages.ToList().SingleOrDefault(sp => sp.Name == "Silver").ServicePackageId, WebSiteURL = "http://2020Imaging.com", Email = "*****@*****.**", Description = "Test_Account_Description", TimeZoneId = _lookupService.GetTimeZones().First().TimeZoneId, AccountTypeId = _lookupService.GetAccountTypes().Single(at => at.AccoutTypeId == 2).AccoutTypeId, AccountBilling = null, }; var accountId = _accountService.AddAccount(accountDto); Assert.IsTrue(accountId > 0); var getAccount = _accountService.GetAccount(accountId); Assert.IsNotNull(getAccount); // step 2 - create person var personDto = new PersonDto { Title = "Msr.", FirstName = "Victor", LastName = "Lungu", JobTitle = "WPF Developer", Password = "******", PrimaryAccountAdministratorPassword = "******", }; var preferedContact1 = new PersonContactTypeDto { ContactTypeId = contactTypes[0].ContactTypeId }; var preferedContact2 = new PersonContactTypeDto { ContactTypeId = contactTypes[1].ContactTypeId }; personDto.PreferedContactTypes = new List <PersonContactTypeDto> { preferedContact1, preferedContact2 }; var savedPerson = _accountService.SaveAccountPerson(personDto, getAccount.AccountId); Assert.IsNotNull(savedPerson); // step 3 - create contact var contactDto = new ContactDto { TelephoneNumber = "37379604494", EmailAddress = "*****@*****.**", MobileNumber = "37379604494", LyncName = "Lync Name", FaxNumber = "37379604494", }; var preferedContatMethod1 = new PreferedContatMethodDto { ContactMethodId = contactMethods[0].ContactMethodId }; var preferedContatMethod2 = new PreferedContatMethodDto { ContactMethodId = contactMethods[1].ContactMethodId }; contactDto.PreferedContatMethods.Add(preferedContatMethod1); contactDto.PreferedContatMethods.Add(preferedContatMethod2); var savedContact = _accountService.SaveAccountContact(contactDto, savedPerson.PersonId); Assert.IsNotNull(savedContact); //step 4 - create accounnt address var addressDto = new AddressDto { AddressNumber = 3343, AddressTypeCode = 22, City = "Chisinau", Country = "Moldova, Republic of", County = "municipiiul Chisinau", Fax = "37379604494", Latitude = 100.22233, Line1 = "str. Iazului 6", Line2 = "ap. 53", Longitude = 444332, Name = "Main Address", PostOfficeBox = "443332", PostalCode = "PC5543" }; var accountAddress = _accountService.SaveAccountAddress(addressDto, accountId); Assert.IsNotNull(accountAddress); //step 5 Billing address var billingAddress = new AddressDto { AddressNumber = 3343, AddressTypeCode = 22, City = "Chisinau", Country = "Moldova, Republic of", County = "municipiiul Chisinau", Fax = "37379604494", Latitude = 100.22233, Line1 = "str. Iazului 6", Line2 = "ap. 53", Longitude = 444332, Name = "Main Address", PostOfficeBox = "443332", PostalCode = "PC5543" }; var accountBilling = new AccountBillingDto { PaymentMethodId = paymentMethods.First().PaymentMethodId, Address = billingAddress }; var accountBillig = _accountService.SaveAccountBilling(accountBilling, accountId); Assert.IsNotNull(accountBillig); var accountNvrAlertTypeDto1 = new AccountNvrAlertTypeDto { NvrAlertTypeId = nvralertTypes.First().NvrAlertTypeId }; var accountNvrAlertTypeDto2 = new AccountNvrAlertTypeDto { NvrAlertTypeId = nvralertTypes.Last().NvrAlertTypeId }; _accountService.SaveAccountNvrAlertType( new List <AccountNvrAlertTypeDto>() { accountNvrAlertTypeDto1, accountNvrAlertTypeDto2 }, accountId); var accountAlarmPanel1 = new AccountAlarmPanelDto() { EventGroupId = eventGroups.First().EventGroupId }; var accountAlarmPanel2 = new AccountAlarmPanelDto() { EventGroupId = eventGroups.Last().EventGroupId }; _accountService.SaveAccountAlarmPanel( new List <AccountAlarmPanelDto>() { accountAlarmPanel1, accountAlarmPanel2 }, accountId); var analyticAlgorithm1 = new AccountAnalyticsAlgorithmTypeDto() { AnalyticsAlgorithTypeId = analyticAlgorithms.First().AnalyticAlgorithmId }; var analyticAlgorithm2 = new AccountAnalyticsAlgorithmTypeDto() { AnalyticsAlgorithTypeId = analyticAlgorithms.Last().AnalyticAlgorithmId }; _accountService.SaveAccountAnalyticsAlgorithms( new List <AccountAnalyticsAlgorithmTypeDto>() { analyticAlgorithm1, analyticAlgorithm2 }, accountId); var deleteContact = _accountService.DeleteContact(savedContact.ContactId); Assert.IsTrue(deleteContact); _accountService.DeletePerson(savedPerson.PersonId); var accountDeleted = _accountService.DeleteAccount(getAccount.AccountId); Assert.IsTrue(accountDeleted); }
public void RemoveAccount(int accountId) { _accountsService.DeleteAccount(accountId); }