Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Grand.Web.Admin - Minor changes

supportc9f8b4184a30
diff --git a/src/Web/Grand.Web.Admin/Controllers/SettingController.cs b/src/Web/Grand.Web.Admin/Controllers/SettingController.cs
index 9e2d6d5e0..e9d643de0 100644
--- a/src/Web/Grand.Web.Admin/Controllers/SettingController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/SettingController.cs
@@ -975,37 +975,30 @@ namespace Grand.Web.Admin.Controllers
{
var pageIndex = 0;
const int pageSize = 100;
- try
+ while (true)
{
- while (true)
- {
- var pictures = _pictureService.GetPictures(pageIndex, pageSize);
- pageIndex++;
- if (!pictures.Any())
- break;
+ var pictures = _pictureService.GetPictures(pageIndex, pageSize);
+ pageIndex++;
+ if (!pictures.Any())
+ break;
- foreach (var picture in pictures)
+ foreach (var picture in pictures)
+ {
+ var pictureBinary = await _pictureService.LoadPictureBinary(picture, !storeIdDb);
+ if (storeIdDb)
+ await _pictureService.DeletePictureOnFileSystem(picture);
+ else
{
- var pictureBinary = await _pictureService.LoadPictureBinary(picture, !storeIdDb);
- if (storeIdDb)
- await _pictureService.DeletePictureOnFileSystem(picture);
- else
- {
- //now on file system
- if (pictureBinary != null)
- await _pictureService.SavePictureInFile(picture.Id, pictureBinary, picture.MimeType);
- }
- picture.PictureBinary = storeIdDb ? pictureBinary : Array.Empty<byte>();
- picture.IsNew = true;
-
- await _pictureService.UpdatePicture(picture);
+ //now on file system
+ if (pictureBinary != null)
+ await _pictureService.SavePictureInFile(picture.Id, pictureBinary, picture.MimeType);
}
+ picture.PictureBinary = storeIdDb ? pictureBinary : Array.Empty<byte>();
+ picture.IsNew = true;
+
+ await _pictureService.UpdatePicture(picture);
}
}
- finally
- {
- }
-
}
#endregion
diff --git a/src/Web/Grand.Web.Admin/Mapper/CategoryProfile.cs b/src/Web/Grand.Web.Admin/Mapper/CategoryProfile.cs
index 066f5bf8f..c7b715725 100644
--- a/src/Web/Grand.Web.Admin/Mapper/CategoryProfile.cs
+++ b/src/Web/Grand.Web.Admin/Mapper/CategoryProfile.cs
@@ -24,7 +24,7 @@ namespace Grand.Web.Admin.Mapper
.ForMember(dest => dest.Locales, mo => mo.Ignore())
.ForMember(dest => dest.CreatedOnUtc, mo => mo.Ignore())
.ForMember(dest => dest.UpdatedOnUtc, mo => mo.Ignore())
- .ForMember(dest => dest.LimitedToGroups, mo => mo.MapFrom(x => x.CustomerGroups == null || !x.CustomerGroups.Any() ? false : true))
+ .ForMember(dest => dest.LimitedToGroups, mo => mo.MapFrom(x => x.CustomerGroups != null && x.CustomerGroups.Any()))
.ForMember(dest => dest.LimitedToStores, mo => mo.MapFrom(x => x.Stores != null && x.Stores.Any()))
.ForMember(dest => dest.AppliedDiscounts, mo => mo.Ignore());
}
diff --git a/src/Web/Grand.Web.Admin/Services/ProductViewModelService.cs b/src/Web/Grand.Web.Admin/Services/ProductViewModelService.cs
index 2431b45a1..c7e6864d5 100644
--- a/src/Web/Grand.Web.Admin/Services/ProductViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/ProductViewModelService.cs
@@ -802,9 +802,7 @@ namespace Grand.Web.Admin.Services
if (model.SearchPublishedId == 3)
showOnHomePage = true;
- var markedAsNewOnly = false;
- if (model.SearchPublishedId == 4)
- markedAsNewOnly = true;
+ var markedAsNewOnly = model.SearchPublishedId == 4;
var products = (await _productService.SearchProducts(
categoryIds: categoryIds,