public static Client UriAdded(Client client, AddedClientUriEvent e) { var uri = new ClientUri() { Id = e.ClientUriId, Type = e.UriType, Uri = e.Uri }; client._uris.Add(uri); return(client); }
public ClientUri AddUri(ClientUriType type, string uri) { ClientUri.ValidateUri(uri); if (_uris.Any(u => u.Type == type && string.Equals(u.Uri, uri, StringComparison.OrdinalIgnoreCase))) { throw new EntityValidationException("A URI with this URL and type already exists on the client!"); } var e = new AddedClientUriEvent() { ClientUriId = Guid.NewGuid(), UriType = type, Uri = uri, ClientId = Id, OccurredOn = DateTime.UtcNow }; _changes.Add(e); EventHandler.UriAdded(this, e); return(_uris.FirstOrDefault(u => u.Id == e.ClientUriId)); }