summaryrefslogtreecommitdiff
path: root/Project-Unite/Models
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-03-25 12:06:19 -0400
committerMichael <[email protected]>2017-03-25 12:06:19 -0400
commitaaebed46d56f3beeb4552d8f18e9b2653959bcce (patch)
tree885b3d995b8f6c6137f8465a07a1747590f3a363 /Project-Unite/Models
parent6e4b5e6de7cc84b6d263f83e6b8327535d5288fc (diff)
downloadproject-unite-aaebed46d56f3beeb4552d8f18e9b2653959bcce.tar.gz
project-unite-aaebed46d56f3beeb4552d8f18e9b2653959bcce.tar.bz2
project-unite-aaebed46d56f3beeb4552d8f18e9b2653959bcce.zip
Skin repo index and viewskin pages
Diffstat (limited to 'Project-Unite/Models')
-rw-r--r--Project-Unite/Models/IdentityModels.cs2
-rw-r--r--Project-Unite/Models/Skin.cs72
2 files changed, 74 insertions, 0 deletions
diff --git a/Project-Unite/Models/IdentityModels.cs b/Project-Unite/Models/IdentityModels.cs
index cb832da..cb4a712 100644
--- a/Project-Unite/Models/IdentityModels.cs
+++ b/Project-Unite/Models/IdentityModels.cs
@@ -194,6 +194,7 @@ namespace Project_Unite.Models
return new ApplicationDbContext();
}
+ public DbSet<Skin> Skins { get; set; }
public DbSet<Configuration> Configs { get; set; }
public DbSet<ShiftoriumUpgrade> ShiftoriumUpgrades { get; set; }
public DbSet<Notification> Notifications { get; set; }
@@ -212,6 +213,7 @@ namespace Project_Unite.Models
public DbSet<ForumPollVote> ForumPollVotes { get; set; }
public DbSet<ForumPost> ForumPosts { get; set; }
public DbSet<Story> Stories { get; set; }
+ public DbSet<View> Views { get; set; }
}
public class UserPost
diff --git a/Project-Unite/Models/Skin.cs b/Project-Unite/Models/Skin.cs
new file mode 100644
index 0000000..5144ccd
--- /dev/null
+++ b/Project-Unite/Models/Skin.cs
@@ -0,0 +1,72 @@
+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 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; }
+
+ [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; }
+ }
+} \ No newline at end of file