Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Core/Grand.Data/LiteDb/LiteDBRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ private Task Update(T entity, UpdateBuilder<T> updateBuilder)
propertyInfo?.SetValue(entity, item.Value);
}

entity.UpdatedOnUtc = _auditInfoProvider.GetCurrentDateTime();
entity.UpdatedBy = _auditInfoProvider.GetCurrentUser();
entity!.UpdatedOnUtc = _auditInfoProvider.GetCurrentDateTime();
entity!.UpdatedBy = _auditInfoProvider.GetCurrentUser();

Collection.Update(entity);
return Task.CompletedTask;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,11 @@ public override Task RemoveByPrefix(string prefix, bool publisher = true)
/// Clear cache
/// </summary>
/// <param name="publisher">publisher</param>
public override Task Clear(bool publisher = true)
public override async Task Clear(bool publisher = true)
{
base.Clear();
await base.Clear(publisher);
if (publisher)
_messageBus.PublishAsync(new MessageEvent { Key = "", MessageType = (int)MessageEventType.ClearCache });
await _messageBus.PublishAsync(new MessageEvent { Key = "", MessageType = (int)MessageEventType.ClearCache });

return Task.CompletedTask;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ protected virtual async Task InstallLocaleResources()

//save resources
var filePath = Path.Combine(_hostingEnvironment.ContentRootPath, "App_Data/Resources/DefaultLanguage.xml");
var localesXml = File.ReadAllText(filePath);
var localesXml = await File.ReadAllTextAsync(filePath);

var xmlDoc = XmlExtensions.LanguageXmlDocument(localesXml);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
@if (await groupService.IsAdmin(currentCustomer))
{
<li>
<a href="@Url.Action("Edit", "Customer", new { currentCustomer.Id, area = Constants.AreaAdmin })">
<a href="@Url.Action("Edit", "Customer", new { currentCustomer!.Id, area = Constants.AreaAdmin })">
<i class="icon-user"></i> @Loc["Admin.Header.Profile"]
</a>
</li>
Expand Down
1 change: 0 additions & 1 deletion src/Web/Grand.Web.Admin/Controllers/OrderController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,6 @@ public async Task<IActionResult> AddressEdit(OrderAddressModel model,

//If we got this far, something failed, redisplay form
model = await orderViewModelService.PrepareOrderAddressModel(order, address);
model.BillingAddress = model.BillingAddress;
return View(model);
}

Expand Down
6 changes: 0 additions & 6 deletions src/Web/Grand.Web.Admin/Controllers/ProductController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,6 @@ public async Task<IActionResult> RelatedProductAddPopup(ProductModel.AddRelatedP

Error(ModelState);
model = await _productViewModelService.PrepareRelatedProductModel();
model.ProductId = model.ProductId;
return View(model);
}

Expand Down Expand Up @@ -729,7 +728,6 @@ public async Task<IActionResult> SimilarProductAddPopup(ProductModel.AddSimilarP

Error(ModelState);
model = await _productViewModelService.PrepareSimilarProductModel();
model.ProductId = model.ProductId;
return View(model);
}

Expand Down Expand Up @@ -827,7 +825,6 @@ public async Task<IActionResult> BundleProductAddPopup(ProductModel.AddBundlePro

Error(ModelState);
model = await _productViewModelService.PrepareBundleProductModel();
model.ProductId = model.ProductId;
return View(model);
}

Expand Down Expand Up @@ -915,7 +912,6 @@ public async Task<IActionResult> CrossSellProductAddPopup(ProductModel.AddCrossS

Error(ModelState);
model = await _productViewModelService.PrepareCrossSellProductModel();
model.ProductId = model.ProductId;
return View(model);
}

Expand Down Expand Up @@ -1002,7 +998,6 @@ public async Task<IActionResult> RecommendedProductAddPopup(ProductModel.AddReco

Error(ModelState);
model = await _productViewModelService.PrepareRecommendedProductModel();
model.ProductId = model.ProductId;
return View(model);
}

Expand Down Expand Up @@ -1108,7 +1103,6 @@ public async Task<IActionResult> AssociatedProductAddPopup(ProductModel.AddAssoc

Error(ModelState);
model = await _productViewModelService.PrepareAssociatedProductModel();
model.ProductId = model.ProductId;
return View(model);
}

Expand Down
5 changes: 2 additions & 3 deletions src/Web/Grand.Web.Admin/Services/ShipmentViewModelService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public virtual async Task<ShipmentModel> PrepareShipmentModel(Shipment shipment,
if (prepareProducts)
foreach (var shipmentItem in shipment.ShipmentItems)
{
var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == shipmentItem.OrderItemId);
var orderItem = order?.OrderItems.FirstOrDefault(x => x.Id == shipmentItem.OrderItemId);
if (orderItem == null)
continue;

Expand Down Expand Up @@ -143,8 +143,7 @@ public virtual async Task<ShipmentModel> PrepareShipmentModel(Shipment shipment,

if (prepareShipmentEvent && !string.IsNullOrEmpty(shipment.TrackingNumber))
{
var srcm = _shippingService.LoadShippingRateCalculationProviderBySystemName(
order.ShippingRateProviderSystemName);
var srcm = _shippingService.LoadShippingRateCalculationProviderBySystemName(order?.ShippingRateProviderSystemName);
if (srcm != null &&
srcm.IsShippingRateMethodActive(_shippingProviderSettings))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ public CurrencyValidator(
{
if (string.IsNullOrEmpty(x))
return true;
//create a CultureInfo object
//if "DisplayLocale" is wrong, then exception will be thrown
new CultureInfo(x);
return true;

var culture = new CultureInfo(x);
return culture != null;
}
catch
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public LanguageValidator(
try
{
//create a CultureInfo object
new CultureInfo(x);
return true;
var culture = new CultureInfo(x);
return culture != null;
}
catch
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public DomainHostValidator(
{
try
{
new Uri(x.Url);
return true;
var uri = new Uri(x.Url);
return uri != null;
}
catch
{
Expand Down
4 changes: 2 additions & 2 deletions src/Web/Grand.Web.Admin/Validators/Stores/StoreValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public StoreValidator(
{
try
{
new Uri(x.Url);
return true;
var uri = new Uri(x.Url);
return uri != null;
}
catch
{
Expand Down
1 change: 0 additions & 1 deletion src/Web/Grand.Web.Vendor/Controllers/ProductController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,6 @@ public async Task<IActionResult> AssociatedProductAddPopup(ProductModel.AddAssoc

Error(ModelState);
model = await _productViewModelService.PrepareAssociatedProductModel();
model.ProductId = model.ProductId;
return View(model);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,10 @@ public async Task<IList<SearchAutoCompleteModel>> Handle(GetSearchAutoComplete r
var category = await _categoryService.GetCategoryById(item);
if (category is not { Published: true }) continue;
var allow = true;
if (!_accessControlConfig.IgnoreAcl)
if (!_aclService.Authorize(category, _contextAccessor.WorkContext.CurrentCustomer))
allow = false;
if (!_accessControlConfig.IgnoreStoreLimitations)
if (!_aclService.Authorize(category, storeId))
allow = false;
if (!_accessControlConfig.IgnoreAcl && !_aclService.Authorize(category, _contextAccessor.WorkContext.CurrentCustomer))
allow = false;
if (!_accessControlConfig.IgnoreStoreLimitations && !_aclService.Authorize(category, storeId))
allow = false;
if (!allow) continue;
var desc = "";
if (_catalogSettings.SearchByDescription)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ public async Task<ShipmentDetailsModel> Handle(GetShipmentDetails request, Cance
if (!string.IsNullOrEmpty(request.Shipment.TrackingNumber))
{
model.TrackingNumber = request.Shipment.TrackingNumber;
var srcm = _shippingService.LoadShippingRateCalculationProviderBySystemName(request.Order
.ShippingRateProviderSystemName);
var srcm = _shippingService.LoadShippingRateCalculationProviderBySystemName(request.Order.ShippingRateProviderSystemName);
if (srcm != null &&
srcm.IsShippingRateMethodActive(_shippingProviderSettings))
{
Expand Down