2011-02-14 19:48:36 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2011-02-14 19:14:13 +00:00
|
|
|
|
using JetBrains.Annotations;
|
2011-02-14 11:01:31 +00:00
|
|
|
|
using VideoGameQuotes.Api;
|
|
|
|
|
|
|
|
|
|
namespace VideoGameQuotes.Web.Models {
|
|
|
|
|
public class QuoteCollectionModel {
|
|
|
|
|
public IEnumerable<Quote> Quotes { get; set; }
|
|
|
|
|
public User User { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-14 19:48:36 +00:00
|
|
|
|
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; } }
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-14 11:01:31 +00:00
|
|
|
|
public class QuoteModel {
|
2011-02-14 19:14:13 +00:00
|
|
|
|
[NotNull]
|
2011-02-14 11:01:31 +00:00
|
|
|
|
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; }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|