public Result <DataProcessingOversightOption, OperationError> RemoveOversightOption(DataProcessingOversightOption oversightOption) { if (oversightOption == null) { throw new ArgumentNullException(nameof(oversightOption)); } if (!HasOversightOption(oversightOption)) { return(new OperationError("Oversight option not assigned", OperationFailure.BadInput)); } OversightOptions.Remove(oversightOption); return(oversightOption); }
private bool HasOversightOption(DataProcessingOversightOption oversightOption) { return(OversightOptions.Any(x => x.Id == oversightOption.Id)); }
public Result <DataProcessingOversightOption, OperationError> AssignOversightOption(DataProcessingOversightOption oversightOption) { if (oversightOption == null) { throw new ArgumentNullException(nameof(oversightOption)); } if (HasOversightOption(oversightOption)) { return(new OperationError("Oversight option already assigned", OperationFailure.Conflict)); } OversightOptions.Add(oversightOption); return(oversightOption); }