hn-dotnet/Domain/Link.cs
Julien Leicher 3cd5133f66 add-aspnet-identity (#26)
add exception filter when user not connected
default to needing authentication and apply anonymous to some actions
add user in get requests
add user relation in link, comment and vote
signup and in are ok now!
2020-12-11 17:59:35 +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);
}
}
}