vgquotes/Src/VideoGameQuotes.Api/Vote.cs
tmont 14ca315213 * dto madness
* api madness
* browse page is beginning to not be empty
* NetVotes -> Score
2011-02-16 02:48:11 +00:00

33 lines
805 B
C#

using System;
using Portoa.Persistence;
namespace VideoGameQuotes.Api {
public class Vote : Entity<Vote, int>, IDtoMappable<VoteDto> {
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;
}
public virtual VoteDto ToDto() {
return new VoteDto {
Id = Id,
Created = Created,
Direction = Direction
};
}
}
public class VoteDto {
public int Id { get; set; }
public DateTime Created { get; set; }
public VoteDirection Direction { get; set; }
}
}