protected void Save_OnClick(object sender, EventArgs e) { if (!canAccessSection) { return; } var settings = BaseMapper.GetObjectFromContext(SettingsMapper.GetSettings()); UpdateObjectFromFields(settings); var returnObj = SettingsMapper.Update(settings); if (returnObj.IsError) { DisplayErrorMessage("Error saving settings", returnObj.Error); } else { ContextHelper.ClearAllMemoryCache(); FileCacheHelper.ClearAllCache(); SettingsMapper.ClearCache(); DisplaySuccessMessage("Successfully saved settings"); } }
protected void Save_OnClick(object sender, EventArgs e) { if (selectedItem == null) { selectedItem = MasterPagesMapper.CreateObject(); } else { selectedItem = BaseMapper.GetObjectFromContext <MasterPage>(selectedItem); } UpdateObjectFromFields(); Return returnObj = selectedItem.Validate(); if (!returnObj.IsError) { if (selectedItem.ID == 0) { returnObj = MasterPagesMapper.Insert(selectedItem); } else { returnObj = MasterPagesMapper.Update(selectedItem); } } if (returnObj.IsError) { DisplayErrorMessage("Error Saving Item", returnObj.Error); } else { SettingsMapper.ClearCache(); DisplaySuccessMessage("Successfully Saved Item"); } }