using System; using Portoa.Persistence; namespace VideoGameQuotes.Api { public class Vote : Entity { public Vote() { Created = DateTime.UtcNow; } public virtual User Voter { get; set; } public virtual Quote Quote { get; set; } public virtual DateTime Created { get; set; } public virtual VoteDirection Direction { get; set; } public static explicit operator int(Vote vote) { return vote.Direction == VoteDirection.Up ? 1 : -1; } } }