本文整理汇总了C#中IAccountService.CreateAccount方法的典型用法代码示例。如果您正苦于以下问题:C# IAccountService.CreateAccount方法的具体用法?C# IAccountService.CreateAccount怎么用?C# IAccountService.CreateAccount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAccountService
的用法示例。
在下文中一共展示了IAccountService.CreateAccount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AccountModule
public AccountModule(IAccountService accountService, IHttpContextAccessor httpContextAccessor)
{
this.context = httpContextAccessor.Current;
Post["/Account/Create"] = x =>
{
var command = new AddUserAccountCommand(Request.Form.EmailAddress,
Request.Form.Password,
uint.Parse(Request.Form.RateOutOf));
var account = accountService.CreateAccount(command);
var accountValidationUrl = context.Request.BaseUrl() + "/Account/Validate/" + account.Key;
return Response.AsJson(new
{
AccountKey = account.Key,
AccountValidationUrl = accountValidationUrl
});
};
Post["/Account/Validate"] = x =>
{
var command = new ValidateAccountCommand(Request.Form.ValidationKey);
return Response.AsJson((int)accountService.ValidateAccount(command));
};
}
示例2: ProcessDatasOnDB
public static void ProcessDatasOnDB(IAccountService AccountService, ICategoryService CategoryService, ITransactionService TransactionService, IOptionService OptionService)
{
#region Categories
var c1 = new Category();
c1.Balance = 7.0;
c1.Color = "FFA640";
c1.Name = "Vacances";
var c2 = new Category();
c2.Balance = 7.0;
c2.Color = "FFA640";
c2.Name = "Profesionnel";
#endregion
#region Accounts
var na1 = new Account();
na1.Balance = 7.0;
na1.BankName = "Credit Agricole";
na1.Name = "Mon compte courant";
var na2 = new Account();
na2.Balance = 7.0;
na2.BankName = "HSBC";
na2.Name = "Mon compte courant";
var na3 = new Account();
na3.Balance = 7.0;
na3.BankName = "HSBC";
na3.Name = "Mon compte epargne HSBC";
#endregion
#region DB Cleaner
var Categories = CategoryService.GetAllCategories(true);
var Accounts = AccountService.GetAllAccounts(true);
if (Categories.Value.Count > 0)
{
foreach (var entity in Categories.Value)
{
CategoryService.DeleteCategorieById(entity.ID);
}
}
if (Accounts.Value.Count > 0)
{
foreach (var entity in Accounts.Value)
{
AccountService.DeleteAccountById(entity.ID);
}
}
var transactions =
#endregion
#region Ajout Données
na1 = AccountService.CreateAccount(new CreateAccountCommand() { BankName = na1.BankName, Name = na1.Name }).Value;
na2 = AccountService.CreateAccount(new CreateAccountCommand() { BankName = na2.BankName, Name = na2.Name }).Value;
na3 = AccountService.CreateAccount(new CreateAccountCommand() { BankName = na3.BankName, Name = na3.Name }).Value;
c1 = CategoryService.CreateCategory(new CreateCategoryCommand() { Name = c1.Name, Color = c1.Color }).Value;
c2 = CategoryService.CreateCategory(new CreateCategoryCommand() { Name = c2.Name, Color = c2.Color }).Value;
#endregion
#region Ajout 26 transactions
var listDeTransaction = new List<Transaction>();
listDeTransaction.Add(new Transaction() { Name = "redevance tv", Account = na1, Amount = -100, Description = "test de la description" });
listDeTransaction.Add(new Transaction() { Name = "les courses", Account = na1, Amount = -80, Description = "test de la description" });
listDeTransaction.Add(new Transaction() { Name = "restau", Account = na2, Category = c2, Amount = -40, Description = "test de la description" });
listDeTransaction.Add(new Transaction() { Name = "piscine", Account = na1, Amount = -10, Description = "test de la description" });
listDeTransaction.Add(new Transaction() { Name = "ciné", Account = na1, Amount = -5, Description = "test de la description" });
listDeTransaction.Add(new Transaction() { Name = "bar", Account = na1, Category = c1, Amount = -10.5, Description = "test de la description" });
listDeTransaction.Add(new Transaction() { Name = "club", Account = na1, Category = c1, Amount = -15.5, Description = "test de la description" });
listDeTransaction.Add(new Transaction() { Name = "lotto", Account = na1, Amount = 7, Description = "test de la description" });
listDeTransaction.Add(new Transaction() { Name = "la biere", Account = na1, Amount = -10, Description = "test de la description" });
listDeTransaction.Add(new Transaction() { Name = "bouquet de fleur", Account = na1, Amount = -20, Description = "test de la description" });
listDeTransaction.Add(new Transaction() { Name = "medicaments", Account = na1, Amount = -5, Description = "test de la description" });
listDeTransaction.Add(new Transaction() { Name = "pizza tv", Account = na1, Amount = -10, Description = "test de la description" });
listDeTransaction.Add(new Transaction() { Name = "moulin de la forge tv", Account = na1, Category = c1, Amount = -150, Description = "test de la description" });
listDeTransaction.Add(new Transaction() { Name = "licence MS", Account = na2, Category = c2, Amount = -35, Description = "test de la description" });
listDeTransaction.Add(new Transaction() { Name = "James", Account = na2, Category = c2, Amount = 500, Description = "test de la description" });
listDeTransaction.Add(new Transaction() { Name = "Ian", Account = na2, Category = c2, Amount = 1000, Description = "test de la description" });
listDeTransaction.Add(new Transaction() { Name = "Villa", Account = na2, Category = c1, Amount = -200, Description = "test de la description" });
listDeTransaction.Add(new Transaction() { Name = "Telephone", Account = na2, Category = c2, Amount = -30, Description = "test de la description" });
listDeTransaction.Add(new Transaction() { Name = "park d'actraction", Account = na2, Amount = -20, Description = "test de la description" });
listDeTransaction.Add(new Transaction() { Name = "enfants", Account = na2, Amount = 46.7, Description = "test de la description" });
listDeTransaction.Add(new Transaction() { Name = "nouvelle maison", Account = na3, Amount = -33.6, Description = "test de la description" });
listDeTransaction.Add(new Transaction() { Name = "epargne taux fixe", Account = na3, Amount = 10, Description = "test de la description" });
listDeTransaction.Add(new Transaction() { Name = "epargne sur montpellier", Account = na3, Amount = 60, Description = "test de la description" });
//.........这里部分代码省略.........
示例3: AccountModule
public AccountModule()
{
this.actService = new AccountService();
this.RequiresAuthentication();
#region Get All SubAccounts
Get["/Accounts"] = x =>
{
var AccountSid = Context.CurrentUser.UserName;
IQueryable<Account> res = actService.GetAllAccounts(AccountSid);
return Response.AsXml<IQueryable<Account>>(res);
};
Get["/Accounts.json"] = x =>
{
var AccountSid = Context.CurrentUser.UserName;
IQueryable<Account> res = actService.GetAllAccounts(AccountSid);
return Response.AsJson<IQueryable<Account>>(res);
};
#endregion
#region Create New SubAccount
Post["/Accounts"] = x =>
{
var request = this.Bind<CreateAccountRequest>();
request.AccountSid = Context.CurrentUser.UserName;
Account res = actService.CreateAccount(request.FriendlyName, request.AccountSid);
return Response.AsXml<Account >(res);
};
Post["/Accounts.json"] = x =>
{
var request = this.Bind<CreateAccountRequest>();
request.AccountSid = Context.CurrentUser.UserName;
Account res = actService.CreateAccount(request.FriendlyName, request.AccountSid);
return Response.AsJson<Account>(res);
};
#endregion
#region Create New Master Account
Post["/Accounts/Master"] = x =>
{
var request = this.Bind<CreateAccountRequest>();
Account res = actService.CreateAccount(request.FriendlyName);
return Response.AsXml<Account>(res);
};
Post["/Accounts/Master.json"] = x =>
{
var request = this.Bind<CreateAccountRequest>();
Account res = actService.CreateAccount(request.FriendlyName);
return Response.AsJson<Account>(res);
};
#endregion
#region Retrive An Account
Get["/Accounts/{AccountSid}"] = x =>
{
if (x.AccountSid != Context.CurrentUser.UserName)
{
return HttpStatusCode.Unauthorized;
}
else
{
var AccountSid = Context.CurrentUser.UserName;
Account res = actService.GetAccount(AccountSid);
return Response.AsXml<Account>(res);
}
};
Get["/Accounts/{AccountSid}.json"] = x =>
{
if (x.AccountSid != Context.CurrentUser.UserName)
{
return HttpStatusCode.Unauthorized;
}
else
{
var AccountSid = Context.CurrentUser.UserName;
Account res = actService.GetAccount(AccountSid);
return Response.AsJson<Account>(res);
}
};
#endregion
#region Modify Account
Post["/Accounts/{AccountSid}"] = x =>
{
if (x.AccountSid != Context.CurrentUser.UserName)
{
return HttpStatusCode.Unauthorized;
}
else
{
var request = this.Bind<ChangeAccountStatusRequest>();
var AccountSid = Context.CurrentUser.UserName;
Account res = actService.ChangeAccountStatus(AccountSid, request.Status);
return Response.AsXml<Account>(res);
}
};
Post["/Accounts/{AccountSid}.json"] = x =>
{
//.........这里部分代码省略.........