public SystemLog.ErrorCodes Remove(SafeGroup safeGroup, int callerId) { using (UBContext ubc = new UBContext()) { SafeGroup exists = ubc.Group_SafeGroups .Where(x => x.GroupId == safeGroup.GroupId) .FirstOrDefault(); if (exists == null) { return(SystemLog.ErrorCodes.Error); } try { ubc.Remove(exists); ubc.SaveChanges(); return(SystemLog.ErrorCodes.OK); } catch (Exception ex) { Utils.Logging.AddLog(new SystemLog() { LoggerName = "Unifiedban", Date = DateTime.Now, Function = "Unifiedban.Data.SafeGroupService.Remove", Level = SystemLog.Levels.Warn, Message = ex.Message, UserId = callerId }); if (ex.InnerException != null) { Utils.Logging.AddLog(new SystemLog() { LoggerName = "Unifiedban.Data", Date = DateTime.Now, Function = "Unifiedban.Data.SafeGroupService.Remove", Level = SystemLog.Levels.Warn, Message = ex.InnerException.Message, UserId = callerId }); } } return(SystemLog.ErrorCodes.Error); } }
public FilterResult DoCheck(string groupId, string text) { SafeGroup isKnown = safeGroups .Where(x => x.GroupId == groupId && x.GroupName == text) .FirstOrDefault(); if (isKnown == null) { return new FilterResult() { CheckName = "SafeGroup", Result = IFilter.FilterResultType.positive } } ; return(new FilterResult() { CheckName = "SafeGroup", Result = IFilter.FilterResultType.negative }); }
public SafeGroup Add(SafeGroup safeGroup, int callerId) { using (UBContext ubc = new UBContext()) { try { ubc.Add(safeGroup); ubc.SaveChanges(); return(safeGroup); } catch (Exception ex) { Utils.Logging.AddLog(new SystemLog() { LoggerName = "Unifiedban", Date = DateTime.Now, Function = "Unifiedban.Data.SafeGroupService.Add", Level = SystemLog.Levels.Warn, Message = ex.Message, UserId = callerId }); if (ex.InnerException != null) { Utils.Logging.AddLog(new SystemLog() { LoggerName = "Unifiedban.Data", Date = DateTime.Now, Function = "Unifiedban.Data.SafeGroupService.Add", Level = SystemLog.Levels.Warn, Message = ex.InnerException.Message, UserId = callerId }); } } return(null); } }