diff --git a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Competencies.cs b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Competencies.cs index bec49e153d..af44129405 100644 --- a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Competencies.cs +++ b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Competencies.cs @@ -137,6 +137,9 @@ public IActionResult AddEditFrameworkCompetency(int frameworkId, int? frameworkC public IActionResult AddEditFrameworkCompetency(int frameworkId, FrameworkCompetency frameworkCompetency, int? frameworkCompetencyGroupId, int frameworkCompetencyId = 0, int[] selectedFlagIds = null) { frameworkCompetency.Description = SanitizerHelper.SanitizeHtmlData(frameworkCompetency.Description); + frameworkCompetency.Description?.Trim(); + var description = HttpUtility.HtmlDecode(HttpUtility.HtmlDecode(frameworkCompetency.Description)); + if (string.IsNullOrWhiteSpace(description)) { frameworkCompetency.Description = null; } if (!ModelState.IsValid) { ModelState.Remove(nameof(FrameworkCompetency.Name)); @@ -161,9 +164,7 @@ public IActionResult AddEditFrameworkCompetency(int frameworkId, FrameworkCompet if (userRole < 2) return StatusCode((int)HttpStatusCode.Forbidden); if (frameworkCompetency.Id > 0) { - frameworkCompetency.Description?.Trim(); - var description = HttpUtility.HtmlDecode(HttpUtility.HtmlDecode(frameworkCompetency.Description)); - if (string.IsNullOrWhiteSpace(description)) { frameworkCompetency.Description = null; } + frameworkService.UpdateFrameworkCompetency(frameworkCompetencyId, frameworkCompetency.Name, frameworkCompetency.Description, adminId); frameworkService.UpdateCompetencyFlags(frameworkId, frameworkCompetency.CompetencyID, selectedFlagIds); diff --git a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs index 4aac5ee437..9b4e26d30f 100644 --- a/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs +++ b/DigitalLearningSolutions.Web/Controllers/FrameworksController/Frameworks.cs @@ -658,6 +658,10 @@ public IActionResult AddCollaborators(string actionname, int frameworkId, bool e Collaborators = collaborators, Error = false, }; + if (TempData["FrameworkError"] != null) + { + ModelState.AddModelError("userEmail", TempData.Peek("FrameworkError").ToString()); + } return View("Developer/Collaborators", model); } @@ -680,11 +684,11 @@ public IActionResult AddCollaborator(string actionname, string userEmail, bool c } else if (collaboratorId == -2) { - TempData["FrameworkError"] = $"User with the email address {userEmail} has been previously added"; + TempData["FrameworkError"] = $"A user with the email address has been previously added"; } else if (collaboratorId == -4) { - TempData["FrameworkError"] = $"The email address {userEmail} must match registered DLS Admin account"; + TempData["FrameworkError"] = $"The email address must match a registered DLS Admin account"; } else { diff --git a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Collaborators.cshtml b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Collaborators.cshtml index b41d1e3c69..7d4320d2dc 100644 --- a/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Collaborators.cshtml +++ b/DigitalLearningSolutions.Web/Views/Frameworks/Developer/Collaborators.cshtml @@ -4,13 +4,17 @@ ViewData["Title"] = "Framework Collaborators"; ViewData["Application"] = "Framework Service"; ViewData["HeaderPathName"] = "Framework Service"; - string errMsg = TempData["FrameworkError"]?.ToString(); + string errMsg = TempData["FrameworkError"]?.ToString(); if (!string.IsNullOrWhiteSpace(errMsg)) { Model.Error = true; } } @section NavMenuItems { } +@if (Model.Error) +{ + +} @if ((string)ViewContext.RouteData.Values["actionname"] == "New") { @section NavBreadcrumbs { @@ -61,12 +65,6 @@ else {

Your framework has been created. Use this page to identify individuals who will be working on it with you.

} -@if (Model.Error) -{ - - Error: @errMsg - -}

Working Group Members