From 6bf6374e004aef84a7973e72a7c93e5cada45c0e Mon Sep 17 00:00:00 2001 From: Cheerpipe Date: Tue, 8 Jun 2021 12:27:53 -0400 Subject: [PATCH] Move fix to storage layer Don't know if this is the better way but works. --- src/Artemis.Storage/Repositories/ProfileCategoryRepository.cs | 1 + .../Screens/Sidebar/Dialogs/SidebarCategoryCreateViewModel.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Artemis.Storage/Repositories/ProfileCategoryRepository.cs b/src/Artemis.Storage/Repositories/ProfileCategoryRepository.cs index 8c8de1110..81aa22772 100644 --- a/src/Artemis.Storage/Repositories/ProfileCategoryRepository.cs +++ b/src/Artemis.Storage/Repositories/ProfileCategoryRepository.cs @@ -41,6 +41,7 @@ namespace Artemis.Storage.Repositories public ProfileCategoryEntity IsUnique(string name, Guid? id) { + name = name.Trim(); if (id == null) return _repository.FirstOrDefault(p => p.Name == name); return _repository.FirstOrDefault(p => p.Name == name && p.Id != id.Value); diff --git a/src/Artemis.UI/Screens/Sidebar/Dialogs/SidebarCategoryCreateViewModel.cs b/src/Artemis.UI/Screens/Sidebar/Dialogs/SidebarCategoryCreateViewModel.cs index 220940164..84f646dff 100644 --- a/src/Artemis.UI/Screens/Sidebar/Dialogs/SidebarCategoryCreateViewModel.cs +++ b/src/Artemis.UI/Screens/Sidebar/Dialogs/SidebarCategoryCreateViewModel.cs @@ -50,7 +50,7 @@ namespace Artemis.UI.Screens.Sidebar.Dialogs private bool BeUniqueCategory(SidebarCategoryCreateViewModel viewModel, string categoryName) { - return _profileCategoryRepository.IsUnique(categoryName.Trim(), null) == null; + return _profileCategoryRepository.IsUnique(categoryName, null) == null; } } } \ No newline at end of file