Deleting an account using the bot
In this step, I will explain how to build a FormFlow to delete an account using this bot.
Add the following class to delete an account:
class DeleteAccount { [Prompt("Are you sure want to delete your account?")] public string DeleteConfirmationMessage; public string DeleteSuccessMessage; };
To delete an account, we need the account number. Define a field for the DeleteAccount
class and one more field for the account number in the Customer
class, as follows:
public DeleteAccount Delete; [Template(TemplateUsage.EnumSelectOne, "Please select your {&} {||}", ChoiceStyle = ChoiceStyleOptions.PerLine)] public string AccountNumber;
Append the following code to the builder
object before OnCompletion(accountStatus)
:
.Field(new FieldReflector<Customer> (nameof(Customer.AccountNumber)) .SetType(null) .SetActive((state) => state.Option == ...