Skip to content

Commit

Permalink
Section 12 - Session Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
bhrugen committed Sep 30, 2021
1 parent 6c40eae commit 83f8fd5
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 4 deletions.
1 change: 1 addition & 0 deletions BulkyBookWeb/Areas/Customer/Controllers/CartController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ public IActionResult OrderConfirmation(int id)
_emailSender.SendEmailAsync(orderHeader.ApplicationUser.Email, "New Order - Bulky Book", "<p>New Order Created</p>");
List<ShoppingCart> shoppingCarts = _unitOfWork.ShoppingCart.GetAll(u => u.ApplicationUserId ==
orderHeader.ApplicationUserId).ToList();
HttpContext.Session.Clear();
_unitOfWork.ShoppingCart.RemoveRange(shoppingCarts);
_unitOfWork.Save();
return View(id);
Expand Down
4 changes: 2 additions & 2 deletions BulkyBookWeb/Areas/Identity/Pages/Account/Login.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@{
ViewData["Title"] = "Log in";
}

<br /><br />
<h1>@ViewData["Title"]</h1>
<div class="row">
<div class="col-md-4">
Expand Down Expand Up @@ -32,7 +32,7 @@
</div>
</div>
<div>
<button id="login-submit" type="submit" class="w-100 btn btn-lg btn-primary">Log in</button>
<button id="login-submit" type="submit" class="w-100 btn btn-primary">Log in</button>
</div>
<div>
<p>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_dependencyType": "appService.windows"
},
"parameters": {
"resourceGroupName": {
"type": "string",
"defaultValue": "DotNetMastery_Course",
"metadata": {
"description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking."
}
},
"resourceGroupLocation": {
"type": "string",
"defaultValue": "eastus2",
"metadata": {
"description": "Location of the resource group. Resource groups could have different location than resources, however by default we use API versions from latest hybrid profile which support all locations for resource types we support."
}
},
"resourceName": {
"type": "string",
"defaultValue": "Bulky",
"metadata": {
"description": "Name of the main resource to be created by this template."
}
},
"resourceLocation": {
"type": "string",
"defaultValue": "[parameters('resourceGroupLocation')]",
"metadata": {
"description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there."
}
}
},
"variables": {
"appServicePlan_name": "[concat('Plan', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
"appServicePlan_ResourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Web/serverFarms/', variables('appServicePlan_name'))]"
},
"resources": [
{
"type": "Microsoft.Resources/resourceGroups",
"name": "[parameters('resourceGroupName')]",
"location": "[parameters('resourceGroupLocation')]",
"apiVersion": "2019-10-01"
},
{
"type": "Microsoft.Resources/deployments",
"name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
"resourceGroup": "[parameters('resourceGroupName')]",
"apiVersion": "2019-10-01",
"dependsOn": [
"[parameters('resourceGroupName')]"
],
"properties": {
"mode": "Incremental",
"template": {
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"location": "[parameters('resourceLocation')]",
"name": "[parameters('resourceName')]",
"type": "Microsoft.Web/sites",
"apiVersion": "2015-08-01",
"tags": {
"[concat('hidden-related:', variables('appServicePlan_ResourceId'))]": "empty"
},
"dependsOn": [
"[variables('appServicePlan_ResourceId')]"
],
"kind": "app",
"properties": {
"name": "[parameters('resourceName')]",
"kind": "app",
"httpsOnly": true,
"reserved": false,
"serverFarmId": "[variables('appServicePlan_ResourceId')]",
"siteConfig": {
"metadata": [
{
"name": "CURRENT_STACK",
"value": "dotnetcore"
}
]
}
},
"identity": {
"type": "SystemAssigned"
}
},
{
"location": "[parameters('resourceLocation')]",
"name": "[variables('appServicePlan_name')]",
"type": "Microsoft.Web/serverFarms",
"apiVersion": "2015-08-01",
"sku": {
"name": "S1",
"tier": "Standard",
"family": "S",
"size": "S1"
},
"properties": {
"name": "[variables('appServicePlan_name')]"
}
}
]
}
}
}
]
}
2 changes: 1 addition & 1 deletion BulkyBookWeb/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<header>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container-fluid">
<a class="navbar-brand" href="#">Navbar</a>
<a class="navbar-brand" href="#">Bulky</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarColor02" aria-controls="navbarColor02" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
Expand Down
3 changes: 2 additions & 1 deletion BulkyBookWeb/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
},
"AllowedHosts": "*",
"ConnectionStrings": {
"DefaultConnection": "Server=.;Database=Bulky1;Trusted_Connection=True;"
"DefaultConnection": "Server=.;Database=Bulky;Trusted_Connection=True;"
//"DefaultConnection": "Server=tcp:dotnetmasteryserver.database.windows.net,1433;Initial Catalog=dotnetmastery_db;Persist Security Info=False;User ID=admin-sql;Password=DotNet123$;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
},
"Stripe": {
"SecretKey": "sk_test_51JcFLuLzMgCIgSRrqSw0rTwIt0RlyKd5EEY4p1ocZqgGq4C3LtIHtwiqODMmadnDwEcykJeWvzE8ec4hBdLOAMS400isCtFIR7",
Expand Down

0 comments on commit 83f8fd5

Please sign in to comment.