mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 06:24:24 +01:00
New feature: Apps limited inventory (#961)
This commit is contained in:
committed by
Nicolas Dorier
parent
fefc45854e
commit
d99beb9811
@@ -127,29 +127,25 @@ namespace BTCPayServer.Controllers
|
||||
StatusMessage = "Error: You are not owner of this store";
|
||||
return RedirectToAction(nameof(ListApps));
|
||||
}
|
||||
var id = Encoders.Base58.EncodeData(RandomUtils.GetBytes(20));
|
||||
using (var ctx = _ContextFactory.CreateContext())
|
||||
var appData = new AppData
|
||||
{
|
||||
var appData = new AppData() { Id = id };
|
||||
appData.StoreDataId = selectedStore;
|
||||
appData.Name = vm.Name;
|
||||
appData.AppType = appType.ToString();
|
||||
ctx.Apps.Add(appData);
|
||||
await ctx.SaveChangesAsync();
|
||||
}
|
||||
StoreDataId = selectedStore,
|
||||
Name = vm.Name,
|
||||
AppType = appType.ToString()
|
||||
};
|
||||
await _AppService.UpdateOrCreateApp(appData);
|
||||
StatusMessage = "App successfully created";
|
||||
CreatedAppId = id;
|
||||
CreatedAppId = appData.Id;
|
||||
|
||||
switch (appType)
|
||||
{
|
||||
case AppType.PointOfSale:
|
||||
return RedirectToAction(nameof(UpdatePointOfSale), new { appId = id });
|
||||
return RedirectToAction(nameof(UpdatePointOfSale), new { appId = appData.Id });
|
||||
case AppType.Crowdfund:
|
||||
return RedirectToAction(nameof(UpdateCrowdfund), new { appId = id });
|
||||
return RedirectToAction(nameof(UpdateCrowdfund), new { appId = appData.Id });
|
||||
default:
|
||||
return RedirectToAction(nameof(ListApps));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
|
||||
Reference in New Issue
Block a user