public bool Commit(Setting entity) { using (var db = DbFactory.GetDataContext()) { var setting = new SystemSetting(); if (entity.Id != null) { setting = db.SystemSettings.First(x => x.SystemSettingId == entity.Id.Value); if (setting == null) throw new UnknownEntityException("Could not find System Setting with Id " + entity.Id.Value); } CopySettingEntityToSystemSetting(entity, setting); if (entity.Id == null) db.SystemSettings.InsertOnSubmit(setting); db.SubmitChanges(); entity.Inserted(setting.SystemSettingId); return true; } }
private Setting PopulateEntity(SystemSetting set) { return new Setting(set.SystemSettingId) { Name = set.KeyName, Value = set.KeyValue, IsSystem = set.IsSystem }; }
private void CopySettingEntityToSystemSetting(Setting setting, SystemSetting set) { set.KeyName = setting.Name; set.KeyValue = setting.Value; set.IsSystem = setting.IsSystem; }
partial void DeleteSystemSetting(SystemSetting instance);
partial void UpdateSystemSetting(SystemSetting instance);
partial void InsertSystemSetting(SystemSetting instance);