vgquotes/Src/VideoGameQuotes.Web/Models/QuoteModel.cs

36 lines
1.1 KiB
C#
Raw Normal View History

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;
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; } }
}
public class QuoteModel {
2011-02-14 19:14:13 +00:00
[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; }
}
}
}