public GlobalSetting GetById(Guid global_setting_id) { return(base.ExecuteFunction("GetById", delegate() { using (var db = this.CreateSQLContext()) { dbGlobalSetting result = (from n in db.dbGlobalSettings where (n.global_setting_id == global_setting_id) select n).FirstOrDefault(); return result.ToDomainModel(); } })); }
public GlobalSetting GetByName(string name) { return(base.ExecuteFunction("GetByName", delegate() { using (var db = this.CreateSQLContext()) { dbGlobalSetting result = (from n in db.dbGlobalSettings where (n.name == name) select n).FirstOrDefault(); return result.ToDomainModel(); } })); }
public GlobalSetting Update(GlobalSetting updateGlobalSetting) { return(base.ExecuteFunction("Update", delegate() { using (var db = base.CreateSQLContext()) { this.PreProcess(updateGlobalSetting, false); var interception = this.Intercept(updateGlobalSetting, false); if (interception.Intercepted) { return interception.ReturnEntity; } dbGlobalSetting found = (from n in db.dbGlobalSettings where n.global_setting_id == updateGlobalSetting.global_setting_id select n).FirstOrDefault(); if (found != null) { GlobalSetting previous = found.ToDomainModel(); found = updateGlobalSetting.ToDbModel(found); db.SaveChanges(); this.AfterUpdatePersisted(db, found, previous); this.DependencyCoordinator.GlobalSettingInvalidated(Dependency.None, found.global_setting_id); } return this.GetById(updateGlobalSetting.global_setting_id); } })); }