コード例 #1
0
 public static async Task PrepareStoresMappingModel <T>(this T baseGrandEntityModel, IStoreMappingSupported storeMapping, bool excludeProperties, IStoreService _storeService)
     where T : BaseEntityModel, IStoreMappingModel
 {
     baseGrandEntityModel.AvailableStores = (await _storeService
                                             .GetAllStores())
                                            .Select(s => new StoreModel {
         Id = s.Id, Name = s.Shortcut
     })
                                            .ToList();
     if (!excludeProperties)
     {
         if (storeMapping != null)
         {
             baseGrandEntityModel.SelectedStoreIds = storeMapping.Stores.ToArray();
         }
     }
 }
コード例 #2
0
 public static async Task PrepareStoresMappingModel <T>(this T baseGrandEntityModel, IStoreMappingSupported storeMapping, IStoreService _storeService, bool excludeProperties, string storeId = null)
     where T : BaseGrandEntityModel, IStoreMappingModel
 {
     baseGrandEntityModel.AvailableStores = (await _storeService
                                             .GetAllStores()).Where(x => x.Id == storeId || string.IsNullOrEmpty(storeId))
                                            .Select(s => new StoreModel {
         Id = s.Id, Name = s.Shortcut
     })
                                            .ToList();
     if (!excludeProperties)
     {
         if (storeMapping != null)
         {
             baseGrandEntityModel.SelectedStoreIds = storeMapping.Stores.ToArray();
         }
     }
     if (!string.IsNullOrEmpty(storeId))
     {
         baseGrandEntityModel.LimitedToStores  = true;
         baseGrandEntityModel.SelectedStoreIds = new string[] { storeId };
     }
 }