public long AddVersionItem(Version version) { long highestVersionId = 0; if (_items.Any()) { highestVersionId = _items.Max(s => s.id); } version.id = ++highestVersionId; _items.Add(version); return highestVersionId; }
public long insert_version_and_get_version_id(string repository_path, string repository_version) { var version = new Version { version = repository_version ?? string.Empty, repository_path = repository_path ?? string.Empty, entry_date = DateTime.Now, modified_date = DateTime.Now, entered_by = get_identity() }; try { var versions = get_versions(); versions.AddVersionItem(version); set_versions(versions); return version.id; } catch (Exception ex) { Log.bound_to(this).log_an_error_event_containing("{0} with provider {1} does not provide a facility for inserting versions at this time.{2}{3}", GetType(), provider, Environment.NewLine, ex.Message); throw; } }