(jsonContent);
+ }
+ catch (MessageQueueException ex) when (ex.MessageQueueErrorCode == MessageQueueErrorCode.IOTimeout)
+ {
+ // No messages available
+ return null;
}
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine($"Failed to receive notification: {ex.Message}");
+ catch (Exception ex)
+ {
+ System.Diagnostics.Debug.WriteLine($"Failed to receive notification: {ex.Message}");
return null;
- }
+ }
+ */
}
public void MarkAsRead(int notificationId)
@@ -95,26 +108,26 @@ public void MarkAsRead(int notificationId)
private string GenerateMessage(string entityType, string entityId, string entityDisplayName, EntityOperation operation)
{
- var displayText = !string.IsNullOrWhiteSpace(entityDisplayName)
- ? $"{entityType} '{entityDisplayName}'"
- : $"{entityType} (ID: {entityId})";
+ var displayText = !string.IsNullOrWhiteSpace(entityDisplayName)
+ ? $"{entityType} '{entityDisplayName}'"
+ : $"{entityType} (ID: {entityId})";
- switch (operation)
+ switch (operation)
{
- case EntityOperation.CREATE:
- return $"New {displayText} has been created";
- case EntityOperation.UPDATE:
- return $"{displayText} has been updated";
- case EntityOperation.DELETE:
- return $"{displayText} has been deleted";
- default:
- return $"{displayText} operation: {operation}";
+ case EntityOperation.CREATE:
+ return $"New {displayText} has been created";
+ case EntityOperation.UPDATE:
+ return $"{displayText} has been updated";
+ case EntityOperation.DELETE:
+ return $"{displayText} has been deleted";
+ default:
+ return $"{displayText} operation: {operation}";
}
}
public void Dispose()
{
- _queue?.Dispose();
+ // _queue?.Dispose();
}
- }
+ }
}
diff --git a/ContosoUniversity/Views/Courses/Create.cshtml b/ContosoUniversity/Views/Courses/Create.cshtml
index 5629ec3..bd974b6 100644
--- a/ContosoUniversity/Views/Courses/Create.cshtml
+++ b/ContosoUniversity/Views/Courses/Create.cshtml
@@ -68,5 +68,6 @@
@section Scripts {
- @Scripts.Render("~/bundles/jqueryval")
+
+
}
diff --git a/ContosoUniversity/Views/Courses/Edit.cshtml b/ContosoUniversity/Views/Courses/Edit.cshtml
index 20a53d2..a63940c 100644
--- a/ContosoUniversity/Views/Courses/Edit.cshtml
+++ b/ContosoUniversity/Views/Courses/Edit.cshtml
@@ -78,5 +78,6 @@
@section Scripts {
- @Scripts.Render("~/bundles/jqueryval")
+
+
}
diff --git a/ContosoUniversity/Views/Departments/Create.cshtml b/ContosoUniversity/Views/Departments/Create.cshtml
index 1820f05..72ab309 100644
--- a/ContosoUniversity/Views/Departments/Create.cshtml
+++ b/ContosoUniversity/Views/Departments/Create.cshtml
@@ -51,5 +51,6 @@
@section Scripts {
- @Scripts.Render("~/bundles/jqueryval")
+
+
}
diff --git a/ContosoUniversity/Views/Departments/Edit.cshtml b/ContosoUniversity/Views/Departments/Edit.cshtml
index 5f9eda0..5c38e94 100644
--- a/ContosoUniversity/Views/Departments/Edit.cshtml
+++ b/ContosoUniversity/Views/Departments/Edit.cshtml
@@ -54,5 +54,6 @@
@section Scripts {
- @Scripts.Render("~/bundles/jqueryval")
+
+
}
diff --git a/ContosoUniversity/Views/Home/StatusErrorCode.cshtml b/ContosoUniversity/Views/Home/StatusErrorCode.cshtml
new file mode 100644
index 0000000..e67e6e6
--- /dev/null
+++ b/ContosoUniversity/Views/Home/StatusErrorCode.cshtml
@@ -0,0 +1,24 @@
+@model int
+
+@{
+ ViewData["Title"] = "Error";
+}
+
+Oops! Something went wrong.
+
+@if (Model == 404)
+{
+ The page you are looking for could not be found.
+}
+else if (Model == 403)
+{
+ You do not have permission to access this resource.
+}
+else if (Model == 500)
+{
+ An internal server error occurred. Please try again later.
+}
+else
+{
+ An unexpected error occurred (Status code: @Model).
+}
diff --git a/ContosoUniversity/Views/Instructors/Create.cshtml b/ContosoUniversity/Views/Instructors/Create.cshtml
index 5f97499..04c885a 100644
--- a/ContosoUniversity/Views/Instructors/Create.cshtml
+++ b/ContosoUniversity/Views/Instructors/Create.cshtml
@@ -87,5 +87,6 @@
@section Scripts {
- @Scripts.Render("~/bundles/jqueryval")
+
+
}
diff --git a/ContosoUniversity/Views/Instructors/Edit.cshtml b/ContosoUniversity/Views/Instructors/Edit.cshtml
index 4f5676f..5fa7642 100644
--- a/ContosoUniversity/Views/Instructors/Edit.cshtml
+++ b/ContosoUniversity/Views/Instructors/Edit.cshtml
@@ -89,5 +89,6 @@
@section Scripts {
- @Scripts.Render("~/bundles/jqueryval")
+
+
}
diff --git a/ContosoUniversity/Views/Shared/Error.cshtml b/ContosoUniversity/Views/Shared/Error.cshtml
index 7d30b81..9dfafdb 100644
--- a/ContosoUniversity/Views/Shared/Error.cshtml
+++ b/ContosoUniversity/Views/Shared/Error.cshtml
@@ -1,4 +1,4 @@
-@model System.Web.Mvc.HandleErrorInfo
+@model ContosoUniversity.Models.ErrorViewModel
@{
ViewBag.Title = "Error";
@@ -7,15 +7,9 @@
Error.
An error occurred while processing your request.
-@if (Model != null && HttpContext.Current.IsDebuggingEnabled)
+@if (!string.IsNullOrEmpty(Model?.RequestId))
{
- Exception Details: @Model.Exception.Message
-
-
- Controller: @Model.ControllerName
-
-
- Action: @Model.ActionName
+ Request ID: @Model.RequestId
}
diff --git a/ContosoUniversity/Views/Shared/_Layout.cshtml b/ContosoUniversity/Views/Shared/_Layout.cshtml
index 98b5062..a3840b5 100644
--- a/ContosoUniversity/Views/Shared/_Layout.cshtml
+++ b/ContosoUniversity/Views/Shared/_Layout.cshtml
@@ -4,9 +4,10 @@
@ViewBag.Title - Contoso University
- @Styles.Render("~/Content/css")
+
+
- @Scripts.Render("~/bundles/modernizr")
+