blob: 521fc54d5f546bd60f440dbdc8dd22630abe58c7 (
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
71
72
73
74
75
76
77
78
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
namespace Project_Unite.Models
{
public class Skin
{
public string Id { get; set; }
public string UserId { get; set; }
public string Name { get; set; }
public string ShortDescription { get; set; }
public string FullDescription { get; set; }
public string VersionId { get; set; }
public string DownloadUrl { get; set; }
public string ScreenshotUrl { get; set; }
public DateTime PostedAt { get; set; }
public string Keywords { get; set; }
public Like[] Likes
{
get
{
return new ApplicationDbContext().Likes.Where(x => x.Topic == this.Id).Where(x => x.IsDislike == false).ToArray();
}
}
public Like[] Dislikes
{
get
{
return new ApplicationDbContext().Likes.Where(x => x.Topic == this.Id).Where(x => x.IsDislike == true).ToArray();
}
}
public View[] Views
{
get
{
return new ApplicationDbContext().Views.Where(x => x.ContentId == this.Id).ToArray();
}
}
}
public class View
{
public string Id { get; set; }
public string ContentId { get; set; }
public string UserId { get; set; }
}
public class CreateSkinViewModel
{
[Required]
[MaxLength(128, ErrorMessage = "Your title may not contain more than 128 characters.")]
[MinLength(5, ErrorMessage = "You need to supply a valuable title.")]
public string Title { get; set; }
public string Keywords { get; set; }
[Required]
[MaxLength(500, ErrorMessage ="Your short description may not contain more than 500 characters.")]
public string ShortDescription { get; set; }
[Required]
[DataType(DataType.Html)]
public string LongDescription { get; set; }
[Required]
[DataType(DataType.Upload)]
public HttpPostedFileBase SkinFile { get; set; }
[DataType(DataType.Upload)]
public HttpPostedFileBase ScreenshotFile { get; set; }
}
}
|