Skip to content

Commit 97b2baa

Browse files
authored
Merge pull request #45 from vbukoev/development
Development
2 parents 7e29766 + 3b501e0 commit 97b2baa

File tree

15 files changed

+268
-26
lines changed

15 files changed

+268
-26
lines changed

CourseNet.Web.ViewModels/Review/ReviewSelectionFormViewModel.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class ReviewSelectionFormViewModel
2929
/// </summary>
3030
[Display(Name = "Дата")]
3131
[DataType(DataType.Date)]
32-
public DateTime Date { get; set; } = DateTime.UtcNow;
32+
public DateTime Date { get; set; } = DateTime.Now;
3333

3434
/// <summary>
3535
/// Course Identifier for the review

CourseNet/Areas/Admin/Views/Courses/Mine.cshtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@model MyCoursesViewModel
22

33
@{
4-
ViewData["Title"] = "Моите курсове";
4+
ViewData["Title"] = "Моите курсове (създадени от администратор)";
55
}
66

77
<div class="container mt-4">

CourseNet/Controllers/CoursesController.cs

-9
Original file line numberDiff line numberDiff line change
@@ -351,15 +351,6 @@ public async Task<IActionResult> Enroll(string id)
351351
return RedirectToAction("Index", "Courses");
352352
}
353353

354-
bool isCourseEnrolled = await courseService.IsEnrolledByIdAsync(id);
355-
356-
if (isCourseEnrolled)
357-
{
358-
TempData[ErrorMessage] = "Вие вече сте записани за този курс! Изберете си друг курс от свободните курсовете!";
359-
360-
return RedirectToAction("Index", "Courses");
361-
}
362-
363354
bool isInstructor = await instructorService.InstructorExistsByUserId(User.GetId()!);
364355

365356
if (isInstructor && !User.IsAdmin())

CourseNet/CourseNet.Web.csproj

-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@
3232
<ProjectReference Include="..\CourseNet.Web.ViewModels\CourseNet.Web.ViewModels.csproj" />
3333
</ItemGroup>
3434

35-
<ItemGroup>
36-
<Folder Include="wwwroot\images\" />
37-
</ItemGroup>
38-
3935
<ItemGroup>
4036
<Compile Update="Properties\Resources.Designer.cs">
4137
<DesignTime>True</DesignTime>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"metadata": {
5+
"_dependencyType": "compute.appService.windows"
6+
},
7+
"parameters": {
8+
"resourceGroupName": {
9+
"type": "string",
10+
"defaultValue": "myResourseGroup",
11+
"metadata": {
12+
"description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking."
13+
}
14+
},
15+
"resourceGroupLocation": {
16+
"type": "string",
17+
"defaultValue": "westeurope",
18+
"metadata": {
19+
"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."
20+
}
21+
},
22+
"resourceName": {
23+
"type": "string",
24+
"defaultValue": "CourseNetWeb",
25+
"metadata": {
26+
"description": "Name of the main resource to be created by this template."
27+
}
28+
},
29+
"resourceLocation": {
30+
"type": "string",
31+
"defaultValue": "[parameters('resourceGroupLocation')]",
32+
"metadata": {
33+
"description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there."
34+
}
35+
}
36+
},
37+
"variables": {
38+
"appServicePlan_name": "[concat('Plan', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
39+
"appServicePlan_ResourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Web/serverFarms/', variables('appServicePlan_name'))]"
40+
},
41+
"resources": [
42+
{
43+
"type": "Microsoft.Resources/resourceGroups",
44+
"name": "[parameters('resourceGroupName')]",
45+
"location": "[parameters('resourceGroupLocation')]",
46+
"apiVersion": "2019-10-01"
47+
},
48+
{
49+
"type": "Microsoft.Resources/deployments",
50+
"name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
51+
"resourceGroup": "[parameters('resourceGroupName')]",
52+
"apiVersion": "2019-10-01",
53+
"dependsOn": [
54+
"[parameters('resourceGroupName')]"
55+
],
56+
"properties": {
57+
"mode": "Incremental",
58+
"template": {
59+
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
60+
"contentVersion": "1.0.0.0",
61+
"resources": [
62+
{
63+
"location": "[parameters('resourceLocation')]",
64+
"name": "[parameters('resourceName')]",
65+
"type": "Microsoft.Web/sites",
66+
"apiVersion": "2015-08-01",
67+
"tags": {
68+
"[concat('hidden-related:', variables('appServicePlan_ResourceId'))]": "empty"
69+
},
70+
"dependsOn": [
71+
"[variables('appServicePlan_ResourceId')]"
72+
],
73+
"kind": "app",
74+
"properties": {
75+
"name": "[parameters('resourceName')]",
76+
"kind": "app",
77+
"httpsOnly": true,
78+
"reserved": false,
79+
"serverFarmId": "[variables('appServicePlan_ResourceId')]",
80+
"siteConfig": {
81+
"metadata": [
82+
{
83+
"name": "CURRENT_STACK",
84+
"value": "dotnetcore"
85+
}
86+
]
87+
}
88+
},
89+
"identity": {
90+
"type": "SystemAssigned"
91+
}
92+
},
93+
{
94+
"location": "[parameters('resourceLocation')]",
95+
"name": "[variables('appServicePlan_name')]",
96+
"type": "Microsoft.Web/serverFarms",
97+
"apiVersion": "2015-08-01",
98+
"sku": {
99+
"name": "S1",
100+
"tier": "Standard",
101+
"family": "S",
102+
"size": "S1"
103+
},
104+
"properties": {
105+
"name": "[variables('appServicePlan_name')]"
106+
}
107+
}
108+
]
109+
}
110+
}
111+
}
112+
]
113+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"metadata": {
5+
"_dependencyType": "compute.appService.windows"
6+
},
7+
"parameters": {
8+
"resourceGroupName": {
9+
"type": "string",
10+
"defaultValue": "CourseNetWeb20240416112518ResourceGroup",
11+
"metadata": {
12+
"description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking."
13+
}
14+
},
15+
"resourceGroupLocation": {
16+
"type": "string",
17+
"defaultValue": "eastus",
18+
"metadata": {
19+
"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."
20+
}
21+
},
22+
"resourceName": {
23+
"type": "string",
24+
"defaultValue": "CourseNetWeb20240416112518",
25+
"metadata": {
26+
"description": "Name of the main resource to be created by this template."
27+
}
28+
},
29+
"resourceLocation": {
30+
"type": "string",
31+
"defaultValue": "[parameters('resourceGroupLocation')]",
32+
"metadata": {
33+
"description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there."
34+
}
35+
}
36+
},
37+
"variables": {
38+
"appServicePlan_name": "[concat('Plan', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
39+
"appServicePlan_ResourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Web/serverFarms/', variables('appServicePlan_name'))]"
40+
},
41+
"resources": [
42+
{
43+
"type": "Microsoft.Resources/resourceGroups",
44+
"name": "[parameters('resourceGroupName')]",
45+
"location": "[parameters('resourceGroupLocation')]",
46+
"apiVersion": "2019-10-01"
47+
},
48+
{
49+
"type": "Microsoft.Resources/deployments",
50+
"name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
51+
"resourceGroup": "[parameters('resourceGroupName')]",
52+
"apiVersion": "2019-10-01",
53+
"dependsOn": [
54+
"[parameters('resourceGroupName')]"
55+
],
56+
"properties": {
57+
"mode": "Incremental",
58+
"template": {
59+
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
60+
"contentVersion": "1.0.0.0",
61+
"resources": [
62+
{
63+
"location": "[parameters('resourceLocation')]",
64+
"name": "[parameters('resourceName')]",
65+
"type": "Microsoft.Web/sites",
66+
"apiVersion": "2015-08-01",
67+
"tags": {
68+
"[concat('hidden-related:', variables('appServicePlan_ResourceId'))]": "empty"
69+
},
70+
"dependsOn": [
71+
"[variables('appServicePlan_ResourceId')]"
72+
],
73+
"kind": "app",
74+
"properties": {
75+
"name": "[parameters('resourceName')]",
76+
"kind": "app",
77+
"httpsOnly": true,
78+
"reserved": false,
79+
"serverFarmId": "[variables('appServicePlan_ResourceId')]",
80+
"siteConfig": {
81+
"metadata": [
82+
{
83+
"name": "CURRENT_STACK",
84+
"value": "dotnetcore"
85+
}
86+
]
87+
}
88+
},
89+
"identity": {
90+
"type": "SystemAssigned"
91+
}
92+
},
93+
{
94+
"location": "[parameters('resourceLocation')]",
95+
"name": "[variables('appServicePlan_name')]",
96+
"type": "Microsoft.Web/serverFarms",
97+
"apiVersion": "2015-08-01",
98+
"sku": {
99+
"name": "S1",
100+
"tier": "Standard",
101+
"family": "S",
102+
"size": "S1"
103+
},
104+
"properties": {
105+
"name": "[variables('appServicePlan_name')]"
106+
}
107+
}
108+
]
109+
}
110+
}
111+
}
112+
]
113+
}

CourseNet/Properties/launchSettings.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"commandName": "Project",
55
"launchBrowser": true,
66
"environmentVariables": {
7-
"ASPNETCORE_ENVIRONMENT": "Development"
7+
"ASPNETCORE_ENVIRONMENT": "Development" //"Development" | "Production"
88
},
99
"dotnetRunMessages": true,
1010
"applicationUrl": "https://localhost:7062;http://localhost:5120"
@@ -13,7 +13,7 @@
1313
"commandName": "IISExpress",
1414
"launchBrowser": true,
1515
"environmentVariables": {
16-
"ASPNETCORE_ENVIRONMENT": "Development"
16+
"ASPNETCORE_ENVIRONMENT": "Development" //"Development" | "Production"
1717
}
1818
}
1919
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"dependencies": {
3+
"mssql1": {
4+
"serviceConnectorResourceId": "",
5+
"secretStore": "AzureAppSettings",
6+
"type": "mssql.onprem",
7+
"connectionId": "ConnectionStrings:DefaultConnection",
8+
"dynamicId": null
9+
}
10+
}
11+
}

CourseNet/Properties/serviceDependencies.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"dependencies": {
33
"mssql1": {
44
"type": "mssql",
5-
"connectionId": "ConnectionStrings:DefaultConnection"
5+
"connectionId": "ConnectionStrings:DefaultConnection",
6+
"dynamicId": null
67
}
78
}
89
}

CourseNet/Views/Courses/Details.cshtml

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<a class="btn btn-primary" href="/Lectures/[email protected]">Натисни тук</a>
3737

3838
<p></p>
39-
@if (isUserInstructor)
39+
@if ((isUserInstructor && isInstructorTeachingCourse) || User.IsAdmin())
4040
{
4141
<a class="btn btn-primary" href="/Lectures/[email protected]">Създай лекция</a>
4242
}
@@ -75,7 +75,7 @@
7575
</p>
7676
<p>Категория: <b>@Model.Category</b></p>
7777
<p>Трудност: <b>@Model.Difficulty</b></p>
78-
<p>Крайна дата: <b>@Model.EndDate</b></p>
78+
<p>Крайна дата и час: <b>@Model.EndDate</b></p>
7979
<div class="form-inline">
8080
@if (User.Identity?.IsAuthenticated ?? false)
8181
{

CourseNet/Views/Home/Error401.cshtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<br>
99
<div class="row">
1010
<div class="col-10">
11-
<img src="https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.elegantthemes.com%2Fblog%2Fwordpress%2F401-error&psig=AOvVaw3hog_5nBA0zmNYtKupJauv&ust=1712218682475000&source=images&cd=vfe&opi=89978449&ved=0CBIQjRxqFwoTCMC7ieHNpYUDFQAAAAAdAAAAABAE" alt="Alternative image" class="img-thumbnail">
11+
<img src="~/images/error/401-unauthorized-t.jpg" alt="Alternative picture"/>
1212
<div class="text-left h4">
1313
<p>Нямаш достъп до тази страница</p>
1414
</div>

CourseNet/Views/Home/Error500.cshtml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@page
2+
3+
@{
4+
ViewData["Title"] = "Internal Server Error";
5+
}
6+
7+
<head>
8+
<meta charset="utf-8" />
9+
<title>Error - Internal Server Error</title>
10+
</head>
11+
<body>
12+
<h1>500 - Internal Server Error</h1>
13+
<img src="https://www.google.com/url?sa=i&url=https%3A%2F%2Fginbits.com%2Fsolutions-to-the-500-internal-server-error%2F&psig=AOvVaw085hVUQWGV_AN539XC2zHp&ust=1713342871586000&source=images&cd=vfe&opi=89978449&ved=0CBIQjRxqFwoTCOjv3tqpxoUDFQAAAAAdAAAAABAE " />
14+
<p>Моля, опитайте по-късно.</p>
15+
</body>

CourseNet/Views/Lectures/AllLecturesForCourse.cshtml

+5-3
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,16 @@
2323
<h4><b>Заглавие на лекцията: </b>@lecture.Title</h4>
2424
<p><i>@lecture.Description</i></p>
2525
<p><b>Дата: </b> @lecture.Date</p>
26-
@if (isUserInstructor)
26+
@if (isUserInstructor || User.IsAdmin())
2727
{
2828
<a asp-area="" asp-controller="Lectures" asp-action="Delete" asp-route-id="@lecture.Id" class="btn btn-danger btn-sm">Премахване на лекцията</a>
2929

30-
<a class="btn btn-primary" href="/Materials/[email protected]">Виж налични материали за лекцията</a>
3130

3231
<a class="btn btn-primary" href="/Materials/[email protected]">Добави материал към лекцията</a>
33-
}
32+
}
33+
<a class="btn btn-primary" href="/Materials/[email protected]">Виж налични материали за лекцията</a>
34+
35+
3436
</div>
3537
}
3638
</div>

CourseNet/Views/Shared/_CoursePartial.cshtml

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<p></p>
4242
}
4343

44-
@if (!Model.IsEnrolled)
44+
@if (!Model.IsEnrolled || User.IsAdmin())
4545
{
4646
@if (!isUserInstructor || User.IsAdmin())
4747
{
@@ -54,7 +54,7 @@
5454
}
5555
else
5656
{
57-
@if (!isUserInstructor && isCourseEnrolled)
57+
@if ((!isUserInstructor && isCourseEnrolled) || User.IsAdmin())
5858
{
5959
<form asp-area="" asp-controller="Courses" asp-action="Leave"
6060
asp-route-id="@Model.Id" method="post">
Loading

0 commit comments

Comments
 (0)