diff --git a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Review.cs b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Review.cs index e9a5304e65..8ecf417de2 100644 --- a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Review.cs +++ b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Review.cs @@ -85,7 +85,24 @@ public IActionResult SubmitFrameworkReview(int frameworkId, int reviewId, string var framework = frameworkService.GetBaseFrameworkByFrameworkId(frameworkId, adminId); if (framework.FrameworkReviewID == 0 || framework.FrameworkReviewID == null) return RedirectToAction("StatusCode", "LearningSolutions", new { code = 410 }); int? commentId = null; - if (!string.IsNullOrWhiteSpace(comment)) commentId = frameworkService.InsertComment(frameworkId, adminId, comment, null); + if (string.IsNullOrWhiteSpace(comment)) + { + ModelState.AddModelError("comment", "Please enter comment"); + var frameworkReview = frameworkService.GetFrameworkReview(frameworkId, adminId, reviewId); + frameworkReview.SignedOff = signedOff; + var model = new SubmitReviewViewModel() + { + FrameworkId = frameworkId, + FrameworkName = framework.FrameworkName, + FrameworkReview = frameworkReview + }; + return View("Developer/SubmitReview", model); + } + else + { + commentId = frameworkService.InsertComment(frameworkId, adminId, comment, null); + } + frameworkService.SubmitFrameworkReview(frameworkId, reviewId, signedOff, commentId); frameworkNotificationService.SendReviewOutcomeNotification(reviewId, User.GetCentreIdKnownNotNull()); return RedirectToAction("ViewFramework", "Frameworks", new { frameworkId, tabname = "Structure" }); diff --git a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/SubmitReview.cshtml b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/SubmitReview.cshtml index 01bc256cf3..c0c07aea63 100644 --- a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/SubmitReview.cshtml +++ b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/SubmitReview.cshtml @@ -1,55 +1,60 @@ @using DigitalLearningSolutions.Web.ViewModels.Frameworks; @model SubmitReviewViewModel; @{ - ViewData["Title"] = Model.FrameworkName; - ViewData["Application"] = "Framework Service"; - ViewData["HeaderPathName"] = "Framework Service"; + ViewData["Title"] = Model.FrameworkName; + ViewData["Application"] = "Framework Service"; + ViewData["HeaderPathName"] = "Framework Service"; + var errorHasOccurred = !ViewData.ModelState.IsValid; } @section NavBreadcrumbs { - + } -

Submit review

- @if (Model.FrameworkReview.SignOffRequired) +

Submit review

+@if (Model.FrameworkReview.SignOffRequired) { -
-

- - Important: - Approval required - -

-

Your approval is required before this framework can be published.

-
+
+

+ + Important: + Approval required + +

+

Your approval is required before this framework can be published.

+
}
-
- - - -
-
-
- - -
- I give my approval to publish this framework for use in its current state -
+ @if (errorHasOccurred) + { + + } +
+ + + +
+
+
+ + +
+ I give my approval to publish this framework for use in its current state +
+
-
- +