Skip to content

Commit dd170d1

Browse files
authoredAug 13, 2024··
Merge pull request #92 from pappyangel/SQLInjection
various minor fixes
2 parents 6ac4e25 + 566aee6 commit dd170d1

File tree

5 files changed

+21
-22
lines changed

5 files changed

+21
-22
lines changed
 

‎frontend/Pages/EditCocktail.cshtml

+12-19
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,12 @@
88

99
@* + (Model.cocktailToEdit.ImagePath ?? "NoImage.jpg"); *@
1010

11-
if (Model.cocktailToEdit.ImagePath is null)
12-
srcContent = srcContent + "NoImageSelected.png";
13-
else
14-
if (Model.cocktailToEdit.ImagePath == "")
15-
srcContent = srcContent + "NoImageSelected.png";
11+
srcContent = srcContent + Model.cocktailToEdit.ImagePath;
12+
13+
if (Model.cocktailToEdit.ImagePath == "NoImageSelected.png")
14+
userImageName = "Please select an image";
1615
else
17-
{
18-
srcContent = srcContent + Model.cocktailToEdit.ImagePath;
19-
userImageName = Model.cocktailToEdit.ImagePath.Substring(37);
20-
}
21-
16+
userImageName = Model.cocktailToEdit.ImagePath.Substring(37);
2217
}
2318

2419

@@ -69,23 +64,19 @@
6964
</div>
7065

7166
<div class="form-group row">
72-
<label asp-for="ctImage" class="col-sm-2 col-form-label"></label>
67+
<label class="col-sm-2 col-form-label">Image</label>
7368
<div class="col-sm-10">
74-
<div class="custom-file">
75-
@*Photo property type is IFormFile, so ASP.NET Core
76-
automatically creates a FileUpload control *@
77-
<input asp-for="ctImage" class="custom-file-input form-control">
69+
<div class="custom-file">
70+
<input asp-for="ctImage" class="custom-file-input form-control">
7871
@* <label class="custom-file-label">Click here to change image</label> *@
7972
<label class="custom-file-label">@userImageName</label>
8073
</div>
8174
</div>
8275
</div>
83-
84-
@*Display the existing employee photo*@
76+
8577
<div class="form-group row col-sm-4 offset-4">
86-
<img class="imageThumbnail" src="@srcContent" asp-append-version="true" />
78+
<img id="imageThumbnail" height=auto width="175" src="@srcContent" asp-append-version="true" />
8779
</div>
88-
8980

9081
<div class="form-group row">
9182
<div class="col-sm-10">
@@ -102,6 +93,8 @@
10293
$('.custom-file-input').on("change", function () {
10394
var fileName = $(this).val().split("\\").pop();
10495
$(this).next('.custom-file-label').html(fileName);
96+
var image = document.getElementById('imageThumbnail');
97+
image.src = URL.createObjectURL(this.files[0]);
10598
});
10699
});
107100
</script>

‎frontend/Pages/Index.cshtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</environment>
1717
</p>
1818
<p>Deployment Date: @Model.envDeploymentDate</p>
19-
<p><a href="https://cocktail-api.azurewebsites.net/cocktails">Hit the API directly!</a></p>
19+
<p><a href="https://cocktail-api.azurewebsites.net/cocktails" target="_blank">Hit the API directly!</a></p>
2020
</div>
2121

2222

‎frontend/Pages/Index.cshtml.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@ public void OnGet()
2626
{
2727
envEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
2828
envDeploymentDate = _config["DeploymentDate"];
29-
29+
if (envEnvironment == "Development")
30+
{
31+
var localNow = DateTimeOffset.Now;
32+
var usEST = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
33+
envDeploymentDate = TimeZoneInfo.ConvertTime(localNow, usEST).ToString("MM/dd/yyyy hh:mm tt");
34+
35+
}
3036
}
3137
}
3238
}

‎frontend/appsettings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
"APIProductionUrl":"https://cocktail-api.azurewebsites.net/cocktails",
1111
"FY25-APIProductionUrl": "https://cocktail-api.azurewebsites.net/cocktails",
1212
"Dev-APIUrl": "http://127.0.0.1:5000/cocktails",
13-
"DeploymentDate": "08/10/2024 10:24 AM"
13+
"DeploymentDate": "09/11/1967 10:24 AM"
1414
}
117 KB
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.