hn-dotnet/Domain/Link.cs
2020-12-11 16:00:29 +01:00

31 lines
653 B
C#

using System;
namespace HN.Domain
{
public sealed class Link : Votable
{
public Guid Id { get; }
public string Url { get; }
public DateTime CreatedAt { get; }
public Guid CreatedBy { get; }
private Link(Guid createdBy, string url) : base()
{
Id = Guid.NewGuid();
CreatedBy = createdBy;
CreatedAt = DateTime.UtcNow;
Url = url;
}
public static Link FromUrl(Guid posterId, string url)
{
return new Link(posterId, url);
}
public Comment AddComment(Guid userId, string content)
{
return new Comment(Id, userId, content);
}
}
}