diff --git a/CC98.Software/.gitattributes b/CC98.Software/.gitattributes
new file mode 100644
index 0000000..1ff0c42
--- /dev/null
+++ b/CC98.Software/.gitattributes
@@ -0,0 +1,63 @@
+###############################################################################
+# Set default behavior to automatically normalize line endings.
+###############################################################################
+* text=auto
+
+###############################################################################
+# Set default behavior for command prompt diff.
+#
+# This is need for earlier builds of msysgit that does not have it on by
+# default for csharp files.
+# Note: This is only used by command line
+###############################################################################
+#*.cs diff=csharp
+
+###############################################################################
+# Set the merge driver for project and solution files
+#
+# Merging from the command prompt will add diff markers to the files if there
+# are conflicts (Merging from VS is not affected by the settings below, in VS
+# the diff markers are never inserted). Diff markers may cause the following
+# file extensions to fail to load in VS. An alternative would be to treat
+# these files as binary and thus will always conflict and require user
+# intervention with every merge. To do so, just uncomment the entries below
+###############################################################################
+#*.sln merge=binary
+#*.csproj merge=binary
+#*.vbproj merge=binary
+#*.vcxproj merge=binary
+#*.vcproj merge=binary
+#*.dbproj merge=binary
+#*.fsproj merge=binary
+#*.lsproj merge=binary
+#*.wixproj merge=binary
+#*.modelproj merge=binary
+#*.sqlproj merge=binary
+#*.wwaproj merge=binary
+
+###############################################################################
+# behavior for image files
+#
+# image files are treated as binary by default.
+###############################################################################
+#*.jpg binary
+#*.png binary
+#*.gif binary
+
+###############################################################################
+# diff behavior for common document formats
+#
+# Convert binary document formats to text before diffing them. This feature
+# is only available from the command line. Turn it on by uncommenting the
+# entries below.
+###############################################################################
+#*.doc diff=astextplain
+#*.DOC diff=astextplain
+#*.docx diff=astextplain
+#*.DOCX diff=astextplain
+#*.dot diff=astextplain
+#*.DOT diff=astextplain
+#*.pdf diff=astextplain
+#*.PDF diff=astextplain
+#*.rtf diff=astextplain
+#*.RTF diff=astextplain
diff --git a/CC98.Software/.gitignore b/CC98.Software/.gitignore
new file mode 100644
index 0000000..3c4efe2
--- /dev/null
+++ b/CC98.Software/.gitignore
@@ -0,0 +1,261 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# DNX
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# TODO: Comment the next line if you want to checkin your web deploy settings
+# but database connection strings (with potential passwords) will be unencrypted
+#*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/packages/repositories.config
+# NuGet v3's project.json files produces more ignoreable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+node_modules/
+orleans.codegen.cs
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+# CodeRush
+.cr/
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
\ No newline at end of file
diff --git a/CC98.Software/CC98.Software.sln b/CC98.Software/CC98.Software.sln
index 7a72da9..87fc356 100644
--- a/CC98.Software/CC98.Software.sln
+++ b/CC98.Software/CC98.Software.sln
@@ -1,14 +1,11 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
-VisualStudioVersion = 15.0.26228.9
+VisualStudioVersion = 15.0.26228.4
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{6486DE3E-291E-49EE-86ED-F06F820F9F6F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EB4C55BA-B694-4CDB-A9FD-722BCBE306E8}"
- ProjectSection(SolutionItems) = preProject
- nuget.config = nuget.config
- EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CC98.Software", "src\CC98.Software\CC98.Software.csproj", "{BDA5FAB8-0415-46C6-9658-41CA99135A7C}"
EndProject
diff --git a/CC98.Software/src/CC98.Software/CC98.Software.csproj b/CC98.Software/src/CC98.Software/CC98.Software.csproj
index 071c590..67e5054 100644
--- a/CC98.Software/src/CC98.Software/CC98.Software.csproj
+++ b/CC98.Software/src/CC98.Software/CC98.Software.csproj
@@ -37,8 +37,12 @@
-
-
+
+
+
+
+
+
@@ -51,4 +55,8 @@
+
+
+
+
diff --git a/CC98.Software/src/CC98.Software/Controllers/AccountController.cs b/CC98.Software/src/CC98.Software/Controllers/AccountController.cs
index 3efb177..76fd836 100644
--- a/CC98.Software/src/CC98.Software/Controllers/AccountController.cs
+++ b/CC98.Software/src/CC98.Software/Controllers/AccountController.cs
@@ -78,5 +78,11 @@ private IActionResult ReturnToLocal(string returnUrl)
return Redirect(returnUrl);
}
+ public async Task LogOut()
+ {
+ await ExternalSignInManager.SignOutAsync();
+ return RedirectToAction("Index","Home");
+ }
+
}
}
diff --git a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs
index 77e0ff3..435ac81 100644
--- a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs
+++ b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs
@@ -5,58 +5,253 @@
using CC98.Software.Data;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using Microsoft.Extensions.Options;
+using Microsoft.EntityFrameworkCore;
+using Sakura.AspNetCore;
+using Sakura.AspNetCore.Mvc;
namespace CC98.Software.Controllers
{
- public class HomeController : Controller
- {
- public IActionResult Index()
- {
- return View();
- }
-
- public IActionResult About()
- {
- ViewData["Message"] = "Your application description page.";
-
- return View();
- }
-
- public IActionResult Upload(UploadWare m,[FromServices]SoftwareDbContext q)
- {
- System.IO.FileStream a=System.IO.File.OpenWrite(System.IO.Path.Combine("File", m.File.FileName)) ;
- m.File.CopyTo(a);
- System.IO.FileStream b = System.IO.File.OpenWrite(System.IO.Path.Combine("File", m.File.FileName));
- m.Photo.CopyTo(b);
- //新开空文件 返回文件流 将IFormFile格式文件转为FileStream存入本地服务器
- Data.Software newfile = new Data.Software
- {
-
- Introduction = m.Introduction,
- File = m.File,
- Platform = m.Platform,
- Size=m.File.Length,
- FileLocation= System.IO.Path.Combine("File", m.File.FileName) ,
- PhotoLocation= System.IO.Path.Combine("File", m.Photo.FileName),
- UpdateTime= DateTimeOffset .Now,
- DownloadNum=0,
- };
-
-
- q.Softwares.Add( newfile);
- return View();
- }
-
- public IActionResult Contact()
- {
- ViewData["Message"] = "Your contact page.";
-
- return View();
- }
-
- public IActionResult Error()
- {
- return View();
- }
- }
+ public class HomeController : Controller
+ {
+ public async Task Index([FromServices] SoftwareDbContext dbContext)
+ {
+ var result = await (from i in dbContext.Categories select i).ToArrayAsync();
+ return View(result);
+ }
+
+ [ValidateAntiForgeryToken]
+ public async Task Upload(UploadWare model, [FromServices] SoftwareDbContext dbContext, [FromServices]IOptions setting)
+ {
+ using (var fileStream = System.IO.File.Create(System.IO.Path.Combine(setting.Value.SaveFileAddress, model.Name)))
+ {
+ await model.File.CopyToAsync(fileStream);
+ }
+
+ using (var graphStream = System.IO.File.Create(System.IO.Path.Combine(setting.Value.SaveGraAddress, model.Name)))
+ {
+ await model.Photo.CopyToAsync(graphStream);
+ }
+ //新开空文件 返回文件流 将IFormFile格式文件转为FileStream存入本地服务器
+ var newFile = new Data.Software
+ {
+ Name = model.Name,
+ Introduction = model.Introduction,
+ Platform = model.Platform,
+ FileLocation = System.IO.Path.Combine(setting.Value.SaveFileAddress, model.Name),
+ PhotoLocation = System.IO.Path.Combine(setting.Value.SaveGraAddress, model.Name),
+ UpdateTime = DateTimeOffset.Now,
+ DownloadNum = 0,
+ Filename = model.File.FileName,
+ };
+
+ dbContext.Softwares.Add(newFile);
+ await dbContext.SaveChangesAsync(true);
+ return View("AfterUploading");
+ }
+ public IActionResult ShowUpload()
+ {
+ return View();
+ }
+
+
+
+ public IActionResult Error()
+ {
+ return View();
+ }
+
+ [Authorize("Manage")]
+ public async Task Background([FromServices] SoftwareDbContext dbContext)
+ {
+ var softwares = await (from i in dbContext.Softwares select i).ToArrayAsync();
+ return View(softwares);
+ }
+
+ public async Task UnAccepted(int id, [FromServices] SoftwareDbContext dbContext)
+ {
+ var software = dbContext.Softwares.Find(id);
+ if (software == null)
+ {
+ return NotFound();
+ }
+ dbContext.Softwares.Remove(software);
+ await dbContext.SaveChangesAsync(true);
+ return RedirectToAction("Background");
+ }
+
+ public async Task Accepted(int id, [FromServices] SoftwareDbContext dbContext)
+ {
+ Data.Software m;
+ m = dbContext.Softwares.Find(id);
+ if (m == null)
+ {
+ return NotFound();
+ }
+ m.IsAccepted = true;
+ await dbContext.SaveChangesAsync(true);
+ return RedirectToAction("Background");
+ }
+
+ public async Task NewCategory(string name, [FromServices] SoftwareDbContext dbContext)
+ {
+ var m = new Category
+ {
+ Name = name
+ };
+ dbContext.Categories.Add(m);
+ await dbContext.SaveChangesAsync(true);
+ return RedirectToAction("CategoryManagement");
+ }
+
+ public async Task Delete(int id, [FromServices] SoftwareDbContext dbContext)
+ {
+ var category = await dbContext.Categories.FindAsync(id);
+ if (category == null)
+ {
+ return NotFound();
+ }
+ else
+ {
+ dbContext.Categories.Remove(category);
+ }
+ await dbContext.SaveChangesAsync(true);
+ return RedirectToAction("CategoryManagement");
+ }
+
+ public async Task CategoryManagement([FromServices] SoftwareDbContext dbContext)
+ {
+ var result = from i in dbContext.Categories select i;
+ var categories = await result.ToArrayAsync();
+ return View(categories);
+ }
+
+ public async Task New2Category(string name, int id, [FromServices] SoftwareDbContext dbContext)
+ {
+ var category = new Category();
+ var categoryParent = await dbContext.Categories.FindAsync(id);
+ category.Name = name;
+ category.Parent = categoryParent;
+ await dbContext.SaveChangesAsync(true);
+ return RedirectToAction("CategoryManagement");
+ }
+
+ [Authorize]
+ public async Task SendMessage(string receivername, string title, string content, [FromServices] SoftwareDbContext dbContext)
+ {
+
+
+ var newmes = new Data.Feedback
+ {
+ Message = content,
+ ReceiverName = receivername,
+ Time = DateTimeOffset.Now,
+ Title = title,
+ SenderName = User.Identity.Name,
+ };
+ dbContext.Feedbacks.Add(newmes);
+ await dbContext.SaveChangesAsync(true);
+ return RedirectToAction("MessageBox");
+ }
+ public async Task MessageBox([FromServices] SoftwareDbContext dbContext,int page=1)
+ {
+ var name = User.Identity.Name;
+
+ var result = from i in dbContext.Feedbacks where (i.ReceiverName == name || i.SenderName == name) select i;
+ await dbContext.SaveChangesAsync(true);
+
+ return View();
+ }
+ public async Task MessageDetail(int id, [FromServices] SoftwareDbContext dbContext)
+ {
+ var m = await dbContext.Feedbacks.FindAsync(id);
+ return View(m);
+ }
+ public async Task Details(int id, [FromServices] SoftwareDbContext dbContext)
+ {
+ var m = await dbContext.Softwares.FindAsync(id);
+ return View(m);
+ }
+ public async Task InList(int classId, [FromServices] SoftwareDbContext dbContext, int page = 1)
+ {
+ ViewBag.Classid = classId;
+ var b = from i in dbContext.Softwares where i.Class.Id == classId select i;
+ var pagedData = await b.ToPagedListAsync(10, page);
+
+ return View("List", pagedData);
+ }
+
+ public async Task ChangeFrequencyT(int id, [FromServices]Data.SoftwareDbContext dbContext)
+ {
+ var p = dbContext.Softwares.Find(id);
+ p.IsFrequent = true;
+ await dbContext.SaveChangesAsync(true);
+ return RedirectToAction("Details");
+ }
+ public async Task ChangeFrequencyF(int id, [FromServices]Data.SoftwareDbContext dbContext)
+ {
+ var p = dbContext.Softwares.Find(id);
+ p.IsFrequent = false;
+ await dbContext.SaveChangesAsync(true);
+ return RedirectToAction("Details");
+ }
+ public async Task ChangeRecommendationT(int id, [FromServices]Data.SoftwareDbContext dbContext)
+ {
+ var p = dbContext.Softwares.Find(id);
+ p.IsRecommended = true;
+ await dbContext.SaveChangesAsync(true);
+ return RedirectToAction("Details");
+ }
+ public async Task ChangeRecommendationF(int id, [FromServices]Data.SoftwareDbContext dbContext)
+ {
+ var p = dbContext.Softwares.Find(id);
+ p.IsRecommended = false;
+ await dbContext.SaveChangesAsync(true);
+ return RedirectToAction("Details");
+ }
+ public async Task Search([FromServices]SoftwareDbContext dbcontext, string content,int page=1)
+ {
+ var x = from i in dbcontext.Softwares
+ where i.Name.Contains(content)
+ select i;
+ ViewBag.Content = content;
+ var pagedData = await x.ToPagedListAsync(10, page);
+ return View("List",pagedData);
+ }
+
+ public async Task DeleteSoftware(int id, [FromServices]SoftwareDbContext dbContext)
+ {
+ var x = dbContext.Softwares.Find(id);
+ dbContext.Softwares.Remove(x);
+ await dbContext.SaveChangesAsync();
+ return RedirectToAction("Index");
+ }
+
+ public IActionResult Download(int id, [FromServices]SoftwareDbContext dbContext)
+ {
+ var x = dbContext.Softwares.Find(id);
+ return PhysicalFile(x.FileLocation, "application/octet-stream", x.Filename);
+ }
+
+ public async Task Inbox([FromServices]SoftwareDbContext dbContext,int page=1)
+ {
+ var name = User.Identity.Name;
+
+ var result = from i in dbContext.Feedbacks where (i.ReceiverName == name ) select i;
+ var pagedData = await result.ToPagedListAsync(10, page);
+
+ return View(pagedData);
+ }
+ public async Task Outbox([FromServices]SoftwareDbContext dbContext, int page = 1)
+ {
+ var name = User.Identity.Name;
+
+ var result = from i in dbContext.Feedbacks where (i.SenderName == name) select i;
+ var pagedData = await result.ToPagedListAsync(10, page);
+
+ return View(pagedData);
+ }
+ }
}
diff --git a/CC98.Software/src/CC98.Software/Controllers/TestdbController.cs b/CC98.Software/src/CC98.Software/Controllers/TestdbController.cs
new file mode 100644
index 0000000..d9835c6
--- /dev/null
+++ b/CC98.Software/src/CC98.Software/Controllers/TestdbController.cs
@@ -0,0 +1,64 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+
+// For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
+
+namespace CC98.Software.Controllers
+{
+ public class TestdbController : Controller
+ {
+ // GET: //
+ public IActionResult AddDb([FromServices]Data.SoftwareDbContext dbContext)
+ {
+
+ for (var i = 1; i <= 100; i++)
+ {
+ var s = new Data.Software
+ {
+ Name = i.ToString(),
+ DownloadNum = 1,
+ IsAccepted = false,
+ IsFrequent = false,
+ Size = 1,
+ UpdateTime = DateTimeOffset.Now,
+ Platform = Data.Platform.Android
+ };
+ dbContext.Softwares.Add(s);
+
+ }
+ dbContext.SaveChanges(true);
+ return RedirectToAction("index", "home");
+ }
+ public IActionResult AddDbcomment([FromServices]Data.SoftwareDbContext dbContext)
+ {
+ for (var i = 1; i <= 100; i++)
+ {
+ var s = new Data.Comment();
+ s.Time = DateTimeOffset.Now;
+ s.Content = i + "abc";
+ var p = new Data.Software();
+ p.Id = i / 3 + 1;
+ s.Software = p;
+ dbContext.Comments.Add(s);
+ }
+ dbContext.SaveChanges(true);
+ return RedirectToAction("index", "home");
+ }
+ public IActionResult AddDbfeedback([FromServices]Data.SoftwareDbContext dbContext)
+ {
+ for (var i = 1; i <= 100; i++)
+ {
+ var s = new Data.Feedback();
+ s.Time = DateTimeOffset.Now;
+ s.Title = i + "abc";
+ s.Message = i + "abcdefg";
+ dbContext.Feedbacks.Add(s);
+ }
+ dbContext.SaveChanges(true);
+ return RedirectToAction("index", "home");
+ }
+ }
+}
diff --git a/CC98.Software/src/CC98.Software/Data/Category.cs b/CC98.Software/src/CC98.Software/Data/Category.cs
new file mode 100644
index 0000000..71045ea
--- /dev/null
+++ b/CC98.Software/src/CC98.Software/Data/Category.cs
@@ -0,0 +1,29 @@
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace CC98.Software.Data
+{
+ public class Category
+ {
+ public int Id
+ {
+ get; set;
+ }
+ [InverseProperty("Parent")]
+ public virtual ICollection Children { get; set; } = new Collection();
+
+ public string Name
+ {
+ get; set;
+ }
+
+ public Category Parent
+ {
+ get; set;
+ }
+ [InverseProperty("Class")]
+ public virtual ICollection Softwares { get; set; } = new Collection();
+
+ }
+}
\ No newline at end of file
diff --git a/CC98.Software/src/CC98.Software/Data/Comment.cs b/CC98.Software/src/CC98.Software/Data/Comment.cs
new file mode 100644
index 0000000..91ebc68
--- /dev/null
+++ b/CC98.Software/src/CC98.Software/Data/Comment.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Collections.ObjectModel;
+using System.ComponentModel.DataAnnotations.Schema;
+
+
+namespace CC98.Software.Data
+{
+ public class Comment
+ {
+ public string Content { get; set; }
+ public DateTimeOffset Time { get; set; }
+ public Software Software { get; set; }
+ public string UserName { get; set; }
+ public int Id { get; set; }
+}
+
+}
diff --git a/CC98.Software/src/CC98.Software/Data/Feedback.cs b/CC98.Software/src/CC98.Software/Data/Feedback.cs
new file mode 100644
index 0000000..d5fb2c8
--- /dev/null
+++ b/CC98.Software/src/CC98.Software/Data/Feedback.cs
@@ -0,0 +1,14 @@
+using System;
+
+namespace CC98.Software.Data
+{
+ public class Feedback
+ {
+ public int Id { get; set; }
+ public string Title { get; set; }
+ public string Message { get; set; }
+ public DateTimeOffset Time { get; set; }
+ public string SenderName { get; set; }
+ public string ReceiverName { get;set; }
+ }
+}
\ No newline at end of file
diff --git a/CC98.Software/src/CC98.Software/Data/Platform.cs b/CC98.Software/src/CC98.Software/Data/Platform.cs
new file mode 100644
index 0000000..a20c661
--- /dev/null
+++ b/CC98.Software/src/CC98.Software/Data/Platform.cs
@@ -0,0 +1,7 @@
+namespace CC98.Software.Data
+{
+ public enum Platform
+ {
+ Windows, Mac, Android, Ios
+ }
+}
\ No newline at end of file
diff --git a/CC98.Software/src/CC98.Software/Data/SearchModel.cs b/CC98.Software/src/CC98.Software/Data/SearchModel.cs
new file mode 100644
index 0000000..f463bcf
--- /dev/null
+++ b/CC98.Software/src/CC98.Software/Data/SearchModel.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.ComponentModel.DataAnnotations;
+
+namespace CC98.Software.Data
+{
+ public class SearchModel
+ {
+ [Required]
+ public string Content { get; set; }
+ }
+}
diff --git a/CC98.Software/src/CC98.Software/Data/Setting.cs b/CC98.Software/src/CC98.Software/Data/Setting.cs
new file mode 100644
index 0000000..c8974a0
--- /dev/null
+++ b/CC98.Software/src/CC98.Software/Data/Setting.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+
+namespace CC98.Software.Data
+{
+ public class Setting
+ {
+ public string FeedbackWeb { get; set; }
+ public string RequireWeb { get; set; }
+ public string SaveFileAddress { get; set; }
+ public string SaveGraAddress { get; set; }
+ }
+
+}
diff --git a/CC98.Software/src/CC98.Software/Data/Software.cs b/CC98.Software/src/CC98.Software/Data/Software.cs
index 8ea3bb4..834fbe5 100644
--- a/CC98.Software/src/CC98.Software/Data/Software.cs
+++ b/CC98.Software/src/CC98.Software/Data/Software.cs
@@ -3,53 +3,25 @@
using System.IO;
using System.Linq;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Http;
+using System.Collections.ObjectModel;
+using System.ComponentModel.DataAnnotations.Schema;
namespace CC98.Software.Data
{
- public class UploadWare
+ public class Software
{
- public string Name
- {
- get; set;
- }
- public Platform Platform
+ ///
+ /// 常用软件标记。
+ ///
+ public bool IsAccepted
{
get; set;
- }
- public string Introduction
- {
- get; set;
- }
- public IFormFile File
- {
- get; set;
- }
- public IFormFile Photo
- {
- get; set;
-
- }
- }
- public class Category
- {
- public int Id
- {
- get; set;
}
-
- public string Name
+ public bool IsFrequent
{
get; set;
}
- }
- public enum Platform
- {
- Windows,Mac,Android,Ios
- }
- public class Software
- {
public string Name
{
get; set;
@@ -67,22 +39,22 @@ public long Size
public Platform Platform
{
- get; set;
+ get; set;
}
public Category Class
{
- get; set;
+ get; set;
}
public string Introduction
{
- get; set;
+ get; set;
}
- public DateTimeOffset UpdateTime
+ public DateTimeOffset UpdateTime
{
- get; set;
+ get; set;
}
public int DownloadNum
@@ -95,20 +67,19 @@ public int Id
get; set;
}
- public IFormFile File
- {
- get; set;
- }
-
public string FileLocation
{
get; set;
}
-
- public IFormFile Photo
+ public string UploaderName
{
get; set;
-
}
+ public bool IsRecommended { get; set; }
+ public string Filename { get; set; }
+
+ [InverseProperty("Software")]
+ public virtual ICollection Comments { get; set; } = new Collection();
+
}
}
diff --git a/CC98.Software/src/CC98.Software/Data/SoftwareDbContext.cs b/CC98.Software/src/CC98.Software/Data/SoftwareDbContext.cs
index 88943a0..0edd02d 100644
--- a/CC98.Software/src/CC98.Software/Data/SoftwareDbContext.cs
+++ b/CC98.Software/src/CC98.Software/Data/SoftwareDbContext.cs
@@ -27,6 +27,9 @@ public SoftwareDbContext(DbContextOptions options) : base(opt
#endregion
public virtual DbSet Softwares { get; set; }
- public virtual DbSet Names { get; set; }
+ public virtual DbSet Categories { get; set; }
+ public virtual DbSet Feedbacks { get; set; }
+ public virtual DbSet Comments { get; set; }
+
}
}
diff --git a/CC98.Software/src/CC98.Software/Data/UploadWare.cs b/CC98.Software/src/CC98.Software/Data/UploadWare.cs
new file mode 100644
index 0000000..7192819
--- /dev/null
+++ b/CC98.Software/src/CC98.Software/Data/UploadWare.cs
@@ -0,0 +1,30 @@
+using Microsoft.AspNetCore.Http;
+
+namespace CC98.Software.Data
+{
+ public class UploadWare
+ {
+ public string Name
+ {
+ get; set;
+ }
+ public Platform Platform
+ {
+ get; set;
+ }
+
+ public string Introduction
+ {
+ get; set;
+ }
+ public IFormFile File
+ {
+ get; set;
+ }
+ public IFormFile Photo
+ {
+ get; set;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/CC98.Software/src/CC98.Software/FrequentSoftwaresViewComponent.cs b/CC98.Software/src/CC98.Software/FrequentSoftwaresViewComponent.cs
new file mode 100644
index 0000000..8ea8cc0
--- /dev/null
+++ b/CC98.Software/src/CC98.Software/FrequentSoftwaresViewComponent.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+
+namespace CC98.Software
+{
+ public class FrequentSoftwaresViewComponent: Microsoft.AspNetCore.Mvc.ViewComponent
+ {
+ public IViewComponentResult Invoke([FromServices] Data.SoftwareDbContext dbContext)
+ {
+ Data.Software[] m;
+ var result = from i in dbContext.Softwares where i.IsFrequent select i;
+ m = result.ToArray();
+ return View(m);
+ }
+ }
+
+}
diff --git a/CC98.Software/src/CC98.Software/HotSoftwaresViewComponent.cs b/CC98.Software/src/CC98.Software/HotSoftwaresViewComponent.cs
new file mode 100644
index 0000000..498c57b
--- /dev/null
+++ b/CC98.Software/src/CC98.Software/HotSoftwaresViewComponent.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+namespace CC98.Software
+{
+ public class HotSoftwaresViewComponent:Microsoft.AspNetCore.Mvc.ViewComponent
+ {
+ public IViewComponentResult Invoke([FromServices] Data.SoftwareDbContext dbContext)
+ {
+ Data.Software[] m;
+ var result = from i in dbContext.Softwares orderby i.DownloadNum descending select i;
+ var c = result.Take(10);
+ m = c.ToArray();
+ return View(m);
+ }
+ }
+}
diff --git a/CC98.Software/src/CC98.Software/Migrations/20170310103544_V1.Designer.cs b/CC98.Software/src/CC98.Software/Migrations/20170310103544_V1.Designer.cs
new file mode 100644
index 0000000..871151f
--- /dev/null
+++ b/CC98.Software/src/CC98.Software/Migrations/20170310103544_V1.Designer.cs
@@ -0,0 +1,101 @@
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using CC98.Software.Data;
+
+namespace CC98.Software.Migrations
+{
+ [DbContext(typeof(SoftwareDbContext))]
+ [Migration("20170310103544_V1")]
+ partial class V1
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+ modelBuilder
+ .HasAnnotation("ProductVersion", "1.1.0-rtm-22752")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("CC98.Software.Data.Category", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Name");
+
+ b.Property("ParentId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ParentId");
+
+ b.ToTable("Categories");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Feedback", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Message");
+
+ b.Property("RecieverName");
+
+ b.Property("SenderName");
+
+ b.Property("Time");
+
+ b.HasKey("Id");
+
+ b.ToTable("Feedbacks");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Software", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("ClassId");
+
+ b.Property("DownloadNum");
+
+ b.Property("FileLocation");
+
+ b.Property("Introduction");
+
+ b.Property("IsFrequent");
+
+ b.Property("Name");
+
+ b.Property("PhotoLocation");
+
+ b.Property("Platform");
+
+ b.Property("Size");
+
+ b.Property("UpdateTime");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClassId");
+
+ b.ToTable("Softwares");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Category", b =>
+ {
+ b.HasOne("CC98.Software.Data.Category", "Parent")
+ .WithMany()
+ .HasForeignKey("ParentId");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Software", b =>
+ {
+ b.HasOne("CC98.Software.Data.Category", "Class")
+ .WithMany()
+ .HasForeignKey("ClassId");
+ });
+ }
+ }
+}
diff --git a/CC98.Software/src/CC98.Software/Migrations/20170310103544_V1.cs b/CC98.Software/src/CC98.Software/Migrations/20170310103544_V1.cs
new file mode 100644
index 0000000..bcbe8a3
--- /dev/null
+++ b/CC98.Software/src/CC98.Software/Migrations/20170310103544_V1.cs
@@ -0,0 +1,99 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Metadata;
+
+namespace CC98.Software.Migrations
+{
+ public partial class V1 : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "Categories",
+ columns: table => new
+ {
+ Id = table.Column(nullable: false)
+ .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
+ Name = table.Column(nullable: true),
+ ParentId = table.Column(nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Categories", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Categories_Categories_ParentId",
+ column: x => x.ParentId,
+ principalTable: "Categories",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Restrict);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Feedbacks",
+ columns: table => new
+ {
+ Id = table.Column(nullable: false)
+ .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
+ Message = table.Column(nullable: true),
+ RecieverName = table.Column(nullable: true),
+ SenderName = table.Column(nullable: true),
+ Time = table.Column(nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Feedbacks", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Softwares",
+ columns: table => new
+ {
+ Id = table.Column(nullable: false)
+ .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
+ ClassId = table.Column(nullable: true),
+ DownloadNum = table.Column(nullable: false),
+ FileLocation = table.Column(nullable: true),
+ Introduction = table.Column(nullable: true),
+ IsFrequent = table.Column(nullable: false),
+ Name = table.Column(nullable: true),
+ PhotoLocation = table.Column(nullable: true),
+ Platform = table.Column(nullable: false),
+ Size = table.Column(nullable: false),
+ UpdateTime = table.Column(nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Softwares", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Softwares_Categories_ClassId",
+ column: x => x.ClassId,
+ principalTable: "Categories",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Restrict);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Categories_ParentId",
+ table: "Categories",
+ column: "ParentId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Softwares_ClassId",
+ table: "Softwares",
+ column: "ClassId");
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "Feedbacks");
+
+ migrationBuilder.DropTable(
+ name: "Softwares");
+
+ migrationBuilder.DropTable(
+ name: "Categories");
+ }
+ }
+}
diff --git a/CC98.Software/src/CC98.Software/Migrations/20170310143109_a.Designer.cs b/CC98.Software/src/CC98.Software/Migrations/20170310143109_a.Designer.cs
new file mode 100644
index 0000000..06ec7e6
--- /dev/null
+++ b/CC98.Software/src/CC98.Software/Migrations/20170310143109_a.Designer.cs
@@ -0,0 +1,103 @@
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using CC98.Software.Data;
+
+namespace CC98.Software.Migrations
+{
+ [DbContext(typeof(SoftwareDbContext))]
+ [Migration("20170310143109_a")]
+ partial class a
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+ modelBuilder
+ .HasAnnotation("ProductVersion", "1.1.0-rtm-22752")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("CC98.Software.Data.Category", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Name");
+
+ b.Property("ParentId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ParentId");
+
+ b.ToTable("Categories");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Feedback", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Message");
+
+ b.Property("RecieverName");
+
+ b.Property("SenderName");
+
+ b.Property("Time");
+
+ b.HasKey("Id");
+
+ b.ToTable("Feedbacks");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Software", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("ClassId");
+
+ b.Property("DownloadNum");
+
+ b.Property("FileLocation");
+
+ b.Property("Introduction");
+
+ b.Property("IsAccepted");
+
+ b.Property("IsFrequent");
+
+ b.Property("Name");
+
+ b.Property("PhotoLocation");
+
+ b.Property("Platform");
+
+ b.Property("Size");
+
+ b.Property("UpdateTime");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClassId");
+
+ b.ToTable("Softwares");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Category", b =>
+ {
+ b.HasOne("CC98.Software.Data.Category", "Parent")
+ .WithMany("Children")
+ .HasForeignKey("ParentId");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Software", b =>
+ {
+ b.HasOne("CC98.Software.Data.Category", "Class")
+ .WithMany()
+ .HasForeignKey("ClassId");
+ });
+ }
+ }
+}
diff --git a/CC98.Software/src/CC98.Software/Migrations/20170310143109_a.cs b/CC98.Software/src/CC98.Software/Migrations/20170310143109_a.cs
new file mode 100644
index 0000000..f474631
--- /dev/null
+++ b/CC98.Software/src/CC98.Software/Migrations/20170310143109_a.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace CC98.Software.Migrations
+{
+ public partial class a : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn(
+ name: "IsAccepted",
+ table: "Softwares",
+ nullable: false,
+ defaultValue: false);
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropColumn(
+ name: "IsAccepted",
+ table: "Softwares");
+ }
+ }
+}
diff --git a/CC98.Software/src/CC98.Software/Migrations/20170324135607_b.Designer.cs b/CC98.Software/src/CC98.Software/Migrations/20170324135607_b.Designer.cs
new file mode 100644
index 0000000..0dc8cff
--- /dev/null
+++ b/CC98.Software/src/CC98.Software/Migrations/20170324135607_b.Designer.cs
@@ -0,0 +1,105 @@
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using CC98.Software.Data;
+
+namespace CC98.Software.Migrations
+{
+ [DbContext(typeof(SoftwareDbContext))]
+ [Migration("20170324135607_b")]
+ partial class b
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+ modelBuilder
+ .HasAnnotation("ProductVersion", "1.1.1")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("CC98.Software.Data.Category", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Name");
+
+ b.Property("ParentId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ParentId");
+
+ b.ToTable("Categories");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Feedback", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Message");
+
+ b.Property("ReceiverName");
+
+ b.Property("SenderName");
+
+ b.Property("Time");
+
+ b.Property("Title");
+
+ b.HasKey("Id");
+
+ b.ToTable("Feedbacks");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Software", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("ClassId");
+
+ b.Property("DownloadNum");
+
+ b.Property("FileLocation");
+
+ b.Property("Introduction");
+
+ b.Property("IsAccepted");
+
+ b.Property("IsFrequent");
+
+ b.Property("Name");
+
+ b.Property("PhotoLocation");
+
+ b.Property("Platform");
+
+ b.Property("Size");
+
+ b.Property("UpdateTime");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClassId");
+
+ b.ToTable("Softwares");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Category", b =>
+ {
+ b.HasOne("CC98.Software.Data.Category", "Parent")
+ .WithMany("Children")
+ .HasForeignKey("ParentId");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Software", b =>
+ {
+ b.HasOne("CC98.Software.Data.Category", "Class")
+ .WithMany()
+ .HasForeignKey("ClassId");
+ });
+ }
+ }
+}
diff --git a/CC98.Software/src/CC98.Software/Migrations/20170324135607_b.cs b/CC98.Software/src/CC98.Software/Migrations/20170324135607_b.cs
new file mode 100644
index 0000000..c0e6e1c
--- /dev/null
+++ b/CC98.Software/src/CC98.Software/Migrations/20170324135607_b.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace CC98.Software.Migrations
+{
+ public partial class b : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.RenameColumn(
+ name: "RecieverName",
+ table: "Feedbacks",
+ newName: "Title");
+
+ migrationBuilder.AddColumn(
+ name: "ReceiverName",
+ table: "Feedbacks",
+ nullable: true);
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropColumn(
+ name: "ReceiverName",
+ table: "Feedbacks");
+
+ migrationBuilder.RenameColumn(
+ name: "Title",
+ table: "Feedbacks",
+ newName: "RecieverName");
+ }
+ }
+}
diff --git a/CC98.Software/src/CC98.Software/Migrations/20170331130534_331update.Designer.cs b/CC98.Software/src/CC98.Software/Migrations/20170331130534_331update.Designer.cs
new file mode 100644
index 0000000..5a53433
--- /dev/null
+++ b/CC98.Software/src/CC98.Software/Migrations/20170331130534_331update.Designer.cs
@@ -0,0 +1,134 @@
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using CC98.Software.Data;
+
+namespace CC98.Software.Migrations
+{
+ [DbContext(typeof(SoftwareDbContext))]
+ [Migration("20170331130534_331update")]
+ partial class _331update
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+ modelBuilder
+ .HasAnnotation("ProductVersion", "1.1.1")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("CC98.Software.Data.Category", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Name");
+
+ b.Property("ParentId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ParentId");
+
+ b.ToTable("Categories");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Comment", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("CommentBelongtoId");
+
+ b.Property("Commenttime");
+
+ b.Property("Contents");
+
+ b.Property("Name");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CommentBelongtoId");
+
+ b.ToTable("Comment");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Feedback", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Message");
+
+ b.Property("ReceiverName");
+
+ b.Property("SenderName");
+
+ b.Property("Time");
+
+ b.Property("Title");
+
+ b.HasKey("Id");
+
+ b.ToTable("Feedbacks");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Software", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("ClassId");
+
+ b.Property("DownloadNum");
+
+ b.Property("FileLocation");
+
+ b.Property("Introduction");
+
+ b.Property("IsAccepted");
+
+ b.Property("IsFrequent");
+
+ b.Property("Name");
+
+ b.Property("PhotoLocation");
+
+ b.Property("Platform");
+
+ b.Property("Size");
+
+ b.Property("UpdateTime");
+
+ b.Property("Uploadername");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClassId");
+
+ b.ToTable("Softwares");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Category", b =>
+ {
+ b.HasOne("CC98.Software.Data.Category", "Parent")
+ .WithMany("Children")
+ .HasForeignKey("ParentId");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Comment", b =>
+ {
+ b.HasOne("CC98.Software.Data.Software", "CommentBelongto")
+ .WithMany("Comments")
+ .HasForeignKey("CommentBelongtoId");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Software", b =>
+ {
+ b.HasOne("CC98.Software.Data.Category", "Class")
+ .WithMany("Softwares")
+ .HasForeignKey("ClassId");
+ });
+ }
+ }
+}
diff --git a/CC98.Software/src/CC98.Software/Migrations/20170331130534_331update.cs b/CC98.Software/src/CC98.Software/Migrations/20170331130534_331update.cs
new file mode 100644
index 0000000..131788c
--- /dev/null
+++ b/CC98.Software/src/CC98.Software/Migrations/20170331130534_331update.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Metadata;
+
+namespace CC98.Software.Migrations
+{
+ public partial class _331update : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn(
+ name: "Uploadername",
+ table: "Softwares",
+ nullable: true);
+
+ migrationBuilder.CreateTable(
+ name: "Comment",
+ columns: table => new
+ {
+ Id = table.Column(nullable: false)
+ .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
+ CommentBelongtoId = table.Column(nullable: true),
+ Commenttime = table.Column(nullable: false),
+ Contents = table.Column(nullable: true),
+ Name = table.Column(nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Comment", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Comment_Softwares_CommentBelongtoId",
+ column: x => x.CommentBelongtoId,
+ principalTable: "Softwares",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Restrict);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Comment_CommentBelongtoId",
+ table: "Comment",
+ column: "CommentBelongtoId");
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "Comment");
+
+ migrationBuilder.DropColumn(
+ name: "Uploadername",
+ table: "Softwares");
+ }
+ }
+}
diff --git a/CC98.Software/src/CC98.Software/Migrations/20170401051933_41update.Designer.cs b/CC98.Software/src/CC98.Software/Migrations/20170401051933_41update.Designer.cs
new file mode 100644
index 0000000..a37f339
--- /dev/null
+++ b/CC98.Software/src/CC98.Software/Migrations/20170401051933_41update.Designer.cs
@@ -0,0 +1,160 @@
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using CC98.Software.Data;
+
+namespace CC98.Software.Migrations
+{
+ [DbContext(typeof(SoftwareDbContext))]
+ [Migration("20170401051933_41update")]
+ partial class _41update
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+ modelBuilder
+ .HasAnnotation("ProductVersion", "1.1.1")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("CC98.Software.Data.Category", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Name");
+
+ b.Property("ParentId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ParentId");
+
+ b.ToTable("Categories");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Comment", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("CommentBelongtoId");
+
+ b.Property("Commenttime");
+
+ b.Property("Contents");
+
+ b.Property("Name");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CommentBelongtoId");
+
+ b.ToTable("Comments");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Feedback", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Message");
+
+ b.Property("ReceiverName");
+
+ b.Property("SenderName");
+
+ b.Property("Time");
+
+ b.Property("Title");
+
+ b.HasKey("Id");
+
+ b.ToTable("Feedbacks");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Manager", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Name");
+
+ b.HasKey("Id");
+
+ b.ToTable("Managers");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.SMessage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Content");
+
+ b.Property("Receivername");
+
+ b.Property("Title");
+
+ b.HasKey("Id");
+
+ b.ToTable("SMessages");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Software", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("ClassId");
+
+ b.Property("DownloadNum");
+
+ b.Property("FileLocation");
+
+ b.Property("Introduction");
+
+ b.Property("IsAccepted");
+
+ b.Property("IsFrequent");
+
+ b.Property("Name");
+
+ b.Property("PhotoLocation");
+
+ b.Property("Platform");
+
+ b.Property("Size");
+
+ b.Property("UpdateTime");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClassId");
+
+ b.ToTable("Softwares");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Category", b =>
+ {
+ b.HasOne("CC98.Software.Data.Category", "Parent")
+ .WithMany("Children")
+ .HasForeignKey("ParentId");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Comment", b =>
+ {
+ b.HasOne("CC98.Software.Data.Software", "CommentBelongto")
+ .WithMany("Comments")
+ .HasForeignKey("CommentBelongtoId");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Software", b =>
+ {
+ b.HasOne("CC98.Software.Data.Category", "Class")
+ .WithMany("Softwares")
+ .HasForeignKey("ClassId");
+ });
+ }
+ }
+}
diff --git a/CC98.Software/src/CC98.Software/Migrations/20170401051933_41update.cs b/CC98.Software/src/CC98.Software/Migrations/20170401051933_41update.cs
new file mode 100644
index 0000000..e779743
--- /dev/null
+++ b/CC98.Software/src/CC98.Software/Migrations/20170401051933_41update.cs
@@ -0,0 +1,119 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Metadata;
+
+namespace CC98.Software.Migrations
+{
+ public partial class _41update : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_Comment_Softwares_CommentBelongtoId",
+ table: "Comment");
+
+ migrationBuilder.DropPrimaryKey(
+ name: "PK_Comment",
+ table: "Comment");
+
+ migrationBuilder.DropColumn(
+ name: "Uploadername",
+ table: "Softwares");
+
+ migrationBuilder.RenameTable(
+ name: "Comment",
+ newName: "Comments");
+
+ migrationBuilder.RenameIndex(
+ name: "IX_Comment_CommentBelongtoId",
+ table: "Comments",
+ newName: "IX_Comments_CommentBelongtoId");
+
+ migrationBuilder.AddPrimaryKey(
+ name: "PK_Comments",
+ table: "Comments",
+ column: "Id");
+
+ migrationBuilder.CreateTable(
+ name: "Managers",
+ columns: table => new
+ {
+ Id = table.Column(nullable: false)
+ .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
+ Name = table.Column(nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Managers", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "SMessages",
+ columns: table => new
+ {
+ Id = table.Column(nullable: false)
+ .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
+ Content = table.Column(nullable: true),
+ Receivername = table.Column(nullable: true),
+ Title = table.Column(nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_SMessages", x => x.Id);
+ });
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_Comments_Softwares_CommentBelongtoId",
+ table: "Comments",
+ column: "CommentBelongtoId",
+ principalTable: "Softwares",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Restrict);
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_Comments_Softwares_CommentBelongtoId",
+ table: "Comments");
+
+ migrationBuilder.DropTable(
+ name: "Managers");
+
+ migrationBuilder.DropTable(
+ name: "SMessages");
+
+ migrationBuilder.DropPrimaryKey(
+ name: "PK_Comments",
+ table: "Comments");
+
+ migrationBuilder.RenameTable(
+ name: "Comments",
+ newName: "Comment");
+
+ migrationBuilder.RenameIndex(
+ name: "IX_Comments_CommentBelongtoId",
+ table: "Comment",
+ newName: "IX_Comment_CommentBelongtoId");
+
+ migrationBuilder.AddColumn(
+ name: "Uploadername",
+ table: "Softwares",
+ nullable: true);
+
+ migrationBuilder.AddPrimaryKey(
+ name: "PK_Comment",
+ table: "Comment",
+ column: "Id");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_Comment_Softwares_CommentBelongtoId",
+ table: "Comment",
+ column: "CommentBelongtoId",
+ principalTable: "Softwares",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Restrict);
+ }
+ }
+}
diff --git a/CC98.Software/src/CC98.Software/Migrations/20170401052337_41again.Designer.cs b/CC98.Software/src/CC98.Software/Migrations/20170401052337_41again.Designer.cs
new file mode 100644
index 0000000..438c07a
--- /dev/null
+++ b/CC98.Software/src/CC98.Software/Migrations/20170401052337_41again.Designer.cs
@@ -0,0 +1,160 @@
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using CC98.Software.Data;
+
+namespace CC98.Software.Migrations
+{
+ [DbContext(typeof(SoftwareDbContext))]
+ [Migration("20170401052337_41again")]
+ partial class _41again
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+ modelBuilder
+ .HasAnnotation("ProductVersion", "1.1.1")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("CC98.Software.Data.Category", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Name");
+
+ b.Property("ParentId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ParentId");
+
+ b.ToTable("Categories");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Comment", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("CommentBelongtoId");
+
+ b.Property("Commenttime");
+
+ b.Property("Contents");
+
+ b.Property("Name");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CommentBelongtoId");
+
+ b.ToTable("Comments");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Feedback", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Message");
+
+ b.Property("ReceiverName");
+
+ b.Property("SenderName");
+
+ b.Property("Time");
+
+ b.Property("Title");
+
+ b.HasKey("Id");
+
+ b.ToTable("Feedbacks");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Manager", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Name");
+
+ b.HasKey("Id");
+
+ b.ToTable("Managers");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.SMessage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Content");
+
+ b.Property("Receivername");
+
+ b.Property("Title");
+
+ b.HasKey("Id");
+
+ b.ToTable("SMessages");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Software", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("ClassId");
+
+ b.Property("DownloadNum");
+
+ b.Property("FileLocation");
+
+ b.Property("Introduction");
+
+ b.Property("IsAccepted");
+
+ b.Property("IsFrequent");
+
+ b.Property("Name");
+
+ b.Property("PhotoLocation");
+
+ b.Property("Platform");
+
+ b.Property("Size");
+
+ b.Property("UpdateTime");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClassId");
+
+ b.ToTable("Softwares");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Category", b =>
+ {
+ b.HasOne("CC98.Software.Data.Category", "Parent")
+ .WithMany("Children")
+ .HasForeignKey("ParentId");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Comment", b =>
+ {
+ b.HasOne("CC98.Software.Data.Software", "CommentBelongto")
+ .WithMany("Comments")
+ .HasForeignKey("CommentBelongtoId");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Software", b =>
+ {
+ b.HasOne("CC98.Software.Data.Category", "Class")
+ .WithMany("Softwares")
+ .HasForeignKey("ClassId");
+ });
+ }
+ }
+}
diff --git a/CC98.Software/src/CC98.Software/Migrations/20170401052337_41again.cs b/CC98.Software/src/CC98.Software/Migrations/20170401052337_41again.cs
new file mode 100644
index 0000000..137224f
--- /dev/null
+++ b/CC98.Software/src/CC98.Software/Migrations/20170401052337_41again.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace CC98.Software.Migrations
+{
+ public partial class _41again : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+
+ }
+ }
+}
diff --git a/CC98.Software/src/CC98.Software/Migrations/20170401053618_wtf.Designer.cs b/CC98.Software/src/CC98.Software/Migrations/20170401053618_wtf.Designer.cs
new file mode 100644
index 0000000..c898735
--- /dev/null
+++ b/CC98.Software/src/CC98.Software/Migrations/20170401053618_wtf.Designer.cs
@@ -0,0 +1,160 @@
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using CC98.Software.Data;
+
+namespace CC98.Software.Migrations
+{
+ [DbContext(typeof(SoftwareDbContext))]
+ [Migration("20170401053618_wtf")]
+ partial class wtf
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+ modelBuilder
+ .HasAnnotation("ProductVersion", "1.1.1")
+ .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
+
+ modelBuilder.Entity("CC98.Software.Data.Category", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Name");
+
+ b.Property("ParentId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ParentId");
+
+ b.ToTable("Categories");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Comment", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("CommentBelongtoId");
+
+ b.Property("Commenttime");
+
+ b.Property("Contents");
+
+ b.Property("Name");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CommentBelongtoId");
+
+ b.ToTable("Comments");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Feedback", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Message");
+
+ b.Property("ReceiverName");
+
+ b.Property("SenderName");
+
+ b.Property("Time");
+
+ b.Property("Title");
+
+ b.HasKey("Id");
+
+ b.ToTable("Feedbacks");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Manager", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Name");
+
+ b.HasKey("Id");
+
+ b.ToTable("Managers");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.SMessage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("Content");
+
+ b.Property("Receivername");
+
+ b.Property("Title");
+
+ b.HasKey("Id");
+
+ b.ToTable("SMessages");
+ });
+
+ modelBuilder.Entity("CC98.Software.Data.Software", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd();
+
+ b.Property("ClassId");
+
+ b.Property("DownloadNum");
+
+ b.Property("FileLocation");
+
+ b.Property("Introduction");
+
+ b.Property("IsAccepted");
+
+ b.Property("IsFrequent");
+
+ b.Property("Name");
+
+ b.Property("PhotoLocation");
+
+ b.Property("Platform");
+
+ b.Property("Size");
+
+ b.Property