本文整理汇总了C#中IBrightstarService.ListStores方法的典型用法代码示例。如果您正苦于以下问题:C# IBrightstarService.ListStores方法的具体用法?C# IBrightstarService.ListStores怎么用?C# IBrightstarService.ListStores使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBrightstarService
的用法示例。
在下文中一共展示了IBrightstarService.ListStores方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StoresModule
public StoresModule(IBrightstarService brightstarService, AbstractSystemPermissionsProvider systemPermissionsProvider)
{
this.RequiresBrightstarSystemPermission(systemPermissionsProvider, get:SystemPermissions.ListStores, post:SystemPermissions.CreateStore);
Get["/"] = parameters =>
{
ViewBag.Title = "Stores";
var stores = brightstarService.ListStores();
return
Negotiate.WithModel(new StoresResponseModel
{
Stores = stores.ToList()
});
};
Post["/"] = parameters =>
{
ViewBag.Title = "Stores";
var request = this.Bind<CreateStoreRequestObject>();
if (request == null || String.IsNullOrEmpty(request.StoreName))
{
return HttpStatusCode.BadRequest;
}
// Return 409 Conflict if attempt to create a store with a name that is currently in use
if (brightstarService.DoesStoreExist(request.StoreName))
{
return HttpStatusCode.Conflict;
}
// Attempt to create the store
try
{
PersistenceType? storePersistenceType = request.GetBrightstarPersistenceType();
if (storePersistenceType.HasValue)
{
brightstarService.CreateStore(request.StoreName, storePersistenceType.Value);
}
else
{
brightstarService.CreateStore(request.StoreName);
}
}
catch (ArgumentException)
{
return HttpStatusCode.BadRequest;
}
return
Negotiate.WithModel(new StoreResponseModel(request.StoreName))
.WithStatusCode(HttpStatusCode.Created);
};
}