vgquotes/Src/VideoGameQuotes.Web/Models/QuoteModel.cs
2011-02-14 19:48:36 +00:00

37 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using VideoGameQuotes.Api;
namespace VideoGameQuotes.Web.Models {
public class QuoteCollectionModel {
public IEnumerable<Quote> Quotes { get; set; }
public User User { get; set; }
}
public class PagedQuoteCollectionModel : QuoteCollectionModel {
public int Start { get; set; }
public int End { get; set; }
public int PageSize { get { return End - Start + 1; } }
public int NextStart { get { return End + 1; } }
public int NextEnd { get { return End + PageSize; } }
public int PreviousStart { get { return Math.Max(0, Start - PageSize); } }
public int PreviousEnd { get { return Math.Max(PageSize - 1, End - PageSize); } }
public bool HasPrevious { get { return Start > 0; } }
}
public class QuoteModel {
[NotNull]
public Quote Quote { get; set; }
public User User { get; set; }
public bool VotedUp {
get { return Quote.VotedFor(User) == VoteDirection.Up; }
}
public bool VotedDown {
get { return Quote.VotedFor(User) == VoteDirection.Down; }
}
}
}