hn-dotnet/Domain/Link.cs
2020-12-10 11:43:47 +01:00

28 lines
589 B
C#

using System;
using System.Collections.Generic;
namespace HN.Domain
{
public sealed class Link
{
public Guid Id { get; }
public string Url { get; }
public DateTime CreatedAt { get; }
private List<Vote> _votes;
public IReadOnlyList<Vote> Votes { get { return _votes; } }
private Link(string url)
{
this.Id = Guid.NewGuid();
this.CreatedAt = DateTime.UtcNow;
this.Url = url;
this._votes = new List<Vote>();
}
public static Link FromUrl(string url)
{
return new Link(url);
}
}
}