public bool Refresh(List<ProviderCategory> categoryList, InsideWordWebLog webLog) { List<KeyValuePair<long, string>> ddList = new List<KeyValuePair<long, string>>(); if (DefaultCategoryId == -1) { ddList.Add(_nullCategory); } ddList.AddRange(categoryList.ToDictionary(aCategory => aCategory.Id.Value, aCategory => aCategory.Title)); CategoryList = new SelectList(ddList, "key", "value", DefaultCategoryId); LogThresholdName = webLog.IWThreshold.Name; LogLevelList = new SelectList(webLog.LevelList, "key", "value", LogThresholdName); LogEmailThresholdName = webLog.IWSmtpThreshold.Name; LogEmailLevelList = new SelectList(webLog.LevelList, "key", "value", LogEmailThresholdName); return true; }
public SettingsManagementVM(InsideWordSettingsDictionary iwSettings, List<ProviderCategory> categoryList, InsideWordWebLog webLog) { long? defaultCategory = iwSettings.DefaultCategoryId; if (defaultCategory.HasValue) { DefaultCategoryId = defaultCategory.Value; } else { DefaultCategoryId = -1; } Refresh(categoryList, webLog); }