blob: 80533c13b4ea791de4e719dcf57ae55c8ea38c9c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Project_Unite.Models
{
public class Contest
{
public string Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public DateTime StartedAt { get; set; }
public DateTime EndsAt { get; set; }
public string VideoId { get; set; }
public long CodepointReward1st { get; set; }
public long CodepointReward2nd { get; set; }
public long CodepointReward3rd { get; set; }
public bool IsEnded
{
get
{
return DateTime.Now >= EndsAt;
}
}
public ContestEntry[] Entries
{
get
{
var db = new ApplicationDbContext();
return db.ContestEntries.Where(x => x.ContestId == this.Id).ToArray();
}
}
}
public class ContestEntry
{
public string Id { get; set; }
public string AuthorId { get; set; }
public string ContestId { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string VideoId { get; set; }
public string DownloadURL { get; set; }
public DateTime PostedAt { get; set; }
public bool Disqualified { get; set; }
public Like[] Downvotes
{
get
{
var db = new ApplicationDbContext();
return db.Likes.Where(x => x.Topic == this.Id && x.IsDislike).ToArray();
}
}
public Like[] Upvotes
{
get
{
var db = new ApplicationDbContext();
return db.Likes.Where(x => x.Topic == this.Id && !x.IsDislike).ToArray();
}
}
}
}
|