Skip to content

Commit e503b8e

Browse files
authored
Merge pull request #1148 from TechnologyEnhancedLearning/TD-5651-ValidationMeassge-Added-UserGroup
TD-5651-Add User Group -Not displaying error message during Duplicate User Group's creation
2 parents 02a21e2 + 78f00d3 commit e503b8e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

AdminUI/LearningHub.Nhs.AdminUI/Controllers/UserGroupController.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,15 @@ public async Task<IActionResult> Details(UserGroupAdminDetailViewModel userGroup
197197
if (userGroup.IsNew())
198198
{
199199
validationResult = await this.userGroupService.CreateUserGroup(userGroup);
200-
userGroup = await this.userGroupService.GetUserGroupAdminDetailbyIdAsync(validationResult.CreatedId.Value);
200+
if (validationResult.IsValid)
201+
{
202+
userGroup = await this.userGroupService.GetUserGroupAdminDetailbyIdAsync(validationResult.CreatedId.Value);
203+
}
204+
else
205+
{
206+
this.ViewBag.ErrorMessage = $"Update failed: {string.Join(Environment.NewLine, validationResult.Details)}";
207+
return this.View("Details", userGroup);
208+
}
201209
}
202210
else
203211
{

0 commit comments

Comments
 (0)