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.

Minor improvements (with CustomerAttributes)

KrzysztofPajak5cb05788ee0a
diff --git a/src/Web/Grand.Web.Admin/Services/CustomerAttributeViewModelService.cs b/src/Web/Grand.Web.Admin/Services/CustomerAttributeViewModelService.cs
index 5ea356508..bc97edb0c 100644
--- a/src/Web/Grand.Web.Admin/Services/CustomerAttributeViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/CustomerAttributeViewModelService.cs
@@ -31,6 +31,10 @@ namespace Grand.Web.Admin.Services
public virtual async Task<CustomerAttribute> InsertCustomerAttributeModel(CustomerAttributeModel model)
{
var customerAttribute = model.ToEntity();
+
+ if (customerAttribute.IsReadOnly && customerAttribute.IsRequired)
+ customerAttribute.IsRequired = false;
+
await _customerAttributeService.InsertCustomerAttribute(customerAttribute);
return customerAttribute;
}
@@ -94,6 +98,9 @@ namespace Grand.Web.Admin.Services
public virtual async Task<CustomerAttribute> UpdateCustomerAttributeModel(CustomerAttributeModel model, CustomerAttribute customerAttribute)
{
customerAttribute = model.ToEntity(customerAttribute);
+ if (customerAttribute.IsReadOnly && customerAttribute.IsRequired)
+ customerAttribute.IsRequired = false;
+
await _customerAttributeService.UpdateCustomerAttribute(customerAttribute);
return customerAttribute;
}