From c6e9ca34fedf8a8739022d86e75a5a911579953b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=A5=E9=9C=86?= <2583993476@qq.com> Date: Fri, 3 Mar 2017 18:29:01 +0800 Subject: [PATCH 01/38] index --- .../src/CC98.Software/Views/Home/Index.cshtml | 188 +++++++++--------- .../CC98.Software/Views/Home/android.cshtml | 5 + .../src/CC98.Software/Views/Home/apple.cshtml | 5 + .../CC98.Software/Views/Shared/_Layout.cshtml | 8 +- .../src/CC98.Software/wwwroot/css/site.css | 13 ++ .../lib/bootstrap/dist/css/bootstrap.css | 1 + 6 files changed, 119 insertions(+), 101 deletions(-) create mode 100644 CC98.Software/src/CC98.Software/Views/Home/android.cshtml create mode 100644 CC98.Software/src/CC98.Software/Views/Home/apple.cshtml diff --git a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml index 3cd243d..2a5d070 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml @@ -1,109 +1,101 @@ @{ - ViewData["Title"] = "Home Page"; + ViewData["Title"] = "首页-CC98软件站"; } +
+
+

软件推荐

+
+
+

软件分类

+
+
视频软件
+
播放器  格式转换
+
聊天工具
+
浏览器
+
音乐软件
+
安全杀毒
+
系统工具
+
备份还原  硬件工具
+
桌面工具  数据恢复
+
系统优化  驱动工具
+
下载工具
+
办公软件
+
文档处理  办公常用
+
图像图片
+
编程工具
+
开发平台  运行库
+
辅助工具
+
行业软件
+
学习工具
+
+
+
+

常用软件集合

+
+
安全上网
+
测试ING    测试ING    测试ING    测试ING    测试ING
+
测试ING    测试ING    测试ING    测试ING    测试ING
+
测试ING    测试ING    测试ING    测试ING    测试ING
+
安全上98
+
测试ING    测试ING    测试ING    测试ING    测试ING
+
测试ING    测试ING    测试ING    测试ING    测试ING
+
测试ING    测试ING    测试ING    测试ING    测试ING
+
安全下载
+
测试ING    测试ING    测试ING    测试ING    测试ING
+
测试ING    测试ING    测试ING    测试ING    测试ING
+
测试ING    测试ING    测试ING    测试ING    测试ING
+
快乐上网
+
测试ING    测试ING    测试ING    测试ING    测试ING
+
测试ING    测试ING    测试ING    测试ING    测试ING
+
测试ING    测试ING    测试ING    测试ING    测试ING
+
就要玩游戏
+
测试ING    测试ING    测试ING    测试ING    测试ING
+
测试ING    测试ING    测试ING    测试ING    测试ING
+ -
+
+ +
+
+ +
-
- Visual Studio - + -
- Package Management - - -
-
-

Application uses

-
    -
  • Sample pages using ASP.NET Core MVC
  • -
  • Bower for managing client-side libraries
  • -
  • Theming using Bootstrap
  • -
-
- - - +
+

常玩游戏下载

+ hhh
diff --git a/CC98.Software/src/CC98.Software/Views/Home/android.cshtml b/CC98.Software/src/CC98.Software/Views/Home/android.cshtml new file mode 100644 index 0000000..613bfd7 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Views/Home/android.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} diff --git a/CC98.Software/src/CC98.Software/Views/Home/apple.cshtml b/CC98.Software/src/CC98.Software/Views/Home/apple.cshtml new file mode 100644 index 0000000..613bfd7 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Views/Home/apple.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} diff --git a/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml b/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml index e2b462b..1a260eb 100644 --- a/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml @@ -30,9 +30,11 @@
diff --git a/CC98.Software/src/CC98.Software/wwwroot/css/site.css b/CC98.Software/src/CC98.Software/wwwroot/css/site.css index a157770..d661580 100644 --- a/CC98.Software/src/CC98.Software/wwwroot/css/site.css +++ b/CC98.Software/src/CC98.Software/wwwroot/css/site.css @@ -36,3 +36,16 @@ textarea { display: none } } +#soft-recommend, +#soft-sort, +#soft-common, +#rank-soft, +#feed-soft, +#game-soft, +#search-soft{ + border-radius:7px; + padding-left:10px; + padding-top:5px; + -moz-border-radius:7px; + -webkit-border-radius:7px; +} \ No newline at end of file diff --git a/CC98.Software/src/CC98.Software/wwwroot/lib/bootstrap/dist/css/bootstrap.css b/CC98.Software/src/CC98.Software/wwwroot/lib/bootstrap/dist/css/bootstrap.css index 42c79d6..4bee707 100644 --- a/CC98.Software/src/CC98.Software/wwwroot/lib/bootstrap/dist/css/bootstrap.css +++ b/CC98.Software/src/CC98.Software/wwwroot/lib/bootstrap/dist/css/bootstrap.css @@ -119,6 +119,7 @@ textarea { } button { overflow: visible; + border-radius:5px; } button, select { From f1a6727dc34c88775ef7f4b3b9c76c57642d7537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=A5=E9=9C=86?= <2583993476@qq.com> Date: Thu, 9 Mar 2017 23:34:33 +0800 Subject: [PATCH 02/38] =?UTF-8?q?=E8=AF=95=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CC98.Software/Views/Home/houtai.cshtml | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 CC98.Software/src/CC98.Software/Views/Home/houtai.cshtml diff --git a/CC98.Software/src/CC98.Software/Views/Home/houtai.cshtml b/CC98.Software/src/CC98.Software/Views/Home/houtai.cshtml new file mode 100644 index 0000000..551eb45 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Views/Home/houtai.cshtml @@ -0,0 +1,28 @@ +@Model Software[] + + +

后台审核界面

+ + + + + + + + + + + @foreach (Software i in Model) + { + + + + + + + + + } + + +
姓名内容
@i.Name@i.Photo@i.Platform@i.Introduction@i.Size@i.FileLocation
\ No newline at end of file From 5c8bc2ae73fb740621ba1c1619fdcd178fd8a201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B0=E5=AD=90=E7=8F=BA?= <912016486@qq.com> Date: Fri, 10 Mar 2017 18:32:11 +0800 Subject: [PATCH 03/38] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/HomeController.cs | 13 ++-- .../src/CC98.Software/Data/Category.cs | 20 ++++++ .../src/CC98.Software/Data/Feedback.cs | 13 ++++ .../src/CC98.Software/Data/Platform.cs | 7 ++ .../src/CC98.Software/Data/Software.cs | 65 +++---------------- .../CC98.Software/Data/SoftwareDbContext.cs | 3 +- .../src/CC98.Software/Data/UploadWare.cs | 30 +++++++++ 7 files changed, 87 insertions(+), 64 deletions(-) create mode 100644 CC98.Software/src/CC98.Software/Data/Category.cs create mode 100644 CC98.Software/src/CC98.Software/Data/Feedback.cs create mode 100644 CC98.Software/src/CC98.Software/Data/Platform.cs create mode 100644 CC98.Software/src/CC98.Software/Data/UploadWare.cs diff --git a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs index 77e0ff3..c51ac49 100644 --- a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs +++ b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs @@ -24,7 +24,8 @@ public IActionResult About() public IActionResult Upload(UploadWare m,[FromServices]SoftwareDbContext q) { - System.IO.FileStream a=System.IO.File.OpenWrite(System.IO.Path.Combine("File", m.File.FileName)) ; + + 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); @@ -33,7 +34,6 @@ public IActionResult Upload(UploadWare m,[FromServices]SoftwareDbContext q) { Introduction = m.Introduction, - File = m.File, Platform = m.Platform, Size=m.File.Length, FileLocation= System.IO.Path.Combine("File", m.File.FileName) , @@ -41,17 +41,14 @@ public IActionResult Upload(UploadWare m,[FromServices]SoftwareDbContext q) UpdateTime= DateTimeOffset .Now, DownloadNum=0, }; - - q.Softwares.Add( newfile); + q.SaveChanges(); return View(); } - public IActionResult Contact() - { - ViewData["Message"] = "Your contact page."; + public IActionResult Contact(SoftwareDbContext dbContext) + { - return View(); } public IActionResult Error() 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..227283d --- /dev/null +++ b/CC98.Software/src/CC98.Software/Data/Category.cs @@ -0,0 +1,20 @@ +namespace CC98.Software.Data +{ + public class Category + { + public int Id + { + get; set; + } + + public string Name + { + get; set; + } + + public Category Parent + { + get; set; + } + } +} \ No newline at end of file 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..69f126e --- /dev/null +++ b/CC98.Software/src/CC98.Software/Data/Feedback.cs @@ -0,0 +1,13 @@ +using System; + +namespace CC98.Software.Data +{ + public class Feedback + { + public int Id { get; set; } + public string Message { get; set; } + public DateTimeOffset Time { get; set; } + public string SenderName { get; set; } + public string RecieverName { 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/Software.cs b/CC98.Software/src/CC98.Software/Data/Software.cs index 8ea3bb4..aa44feb 100644 --- a/CC98.Software/src/CC98.Software/Data/Software.cs +++ b/CC98.Software/src/CC98.Software/Data/Software.cs @@ -3,53 +3,18 @@ using System.IO; using System.Linq; using System.Threading.Tasks; -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; - - } - } - public class Category + public class Software { - 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 +32,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 +60,10 @@ public int Id get; set; } - public IFormFile File - { - get; set; - } - public string FileLocation { get; set; } - public IFormFile Photo - { - get; set; - - } } } diff --git a/CC98.Software/src/CC98.Software/Data/SoftwareDbContext.cs b/CC98.Software/src/CC98.Software/Data/SoftwareDbContext.cs index 88943a0..d320523 100644 --- a/CC98.Software/src/CC98.Software/Data/SoftwareDbContext.cs +++ b/CC98.Software/src/CC98.Software/Data/SoftwareDbContext.cs @@ -27,6 +27,7 @@ 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; } } } 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 From 2fb8754bfdc1293e98c1f2a5bb9dd70b8ebb73a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B0=E5=AD=90=E7=8F=BA?= <912016486@qq.com> Date: Fri, 10 Mar 2017 18:36:33 +0800 Subject: [PATCH 04/38] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E8=BF=81?= =?UTF-8?q?=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/HomeController.cs | 5 - .../Migrations/20170310103544_V1.Designer.cs | 101 ++++++++++++++++++ .../Migrations/20170310103544_V1.cs | 99 +++++++++++++++++ .../SoftwareDbContextModelSnapshot.cs | 100 +++++++++++++++++ 4 files changed, 300 insertions(+), 5 deletions(-) create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170310103544_V1.Designer.cs create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170310103544_V1.cs create mode 100644 CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs diff --git a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs index c51ac49..e4d2820 100644 --- a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs +++ b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs @@ -46,11 +46,6 @@ public IActionResult Upload(UploadWare m,[FromServices]SoftwareDbContext q) return View(); } - public IActionResult Contact(SoftwareDbContext dbContext) - { - - } - public IActionResult Error() { return View(); 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/SoftwareDbContextModelSnapshot.cs b/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs new file mode 100644 index 0000000..0498ab3 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs @@ -0,0 +1,100 @@ +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))] + partial class SoftwareDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(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"); + }); + } + } +} From 4c03d2e11c5e8c519b185e02cace78b5198671f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=A5=E9=9C=86?= <2583993476@qq.com> Date: Fri, 10 Mar 2017 18:50:54 +0800 Subject: [PATCH 05/38] new --- .../Controllers/HomeController.cs | 19 +++++++++++++++++-- .../src/CC98.Software/Views/Home/Index.cshtml | 2 +- .../Home/{About.cshtml => desktop.cshtml} | 0 .../Home/{Contact.cshtml => game.cshtml} | 0 .../CC98.Software/Views/Home/houtai.cshtml | 9 +++++++-- .../CC98.Software/Views/Shared/_Layout.cshtml | 4 ++-- 6 files changed, 27 insertions(+), 7 deletions(-) rename CC98.Software/src/CC98.Software/Views/Home/{About.cshtml => desktop.cshtml} (100%) rename CC98.Software/src/CC98.Software/Views/Home/{Contact.cshtml => game.cshtml} (100%) diff --git a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs index 77e0ff3..a1516db 100644 --- a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs +++ b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs @@ -15,7 +15,7 @@ public IActionResult Index() return View(); } - public IActionResult About() + public IActionResult desktop() { ViewData["Message"] = "Your application description page."; @@ -47,7 +47,7 @@ public IActionResult Upload(UploadWare m,[FromServices]SoftwareDbContext q) return View(); } - public IActionResult Contact() + public IActionResult game() { ViewData["Message"] = "Your contact page."; @@ -58,5 +58,20 @@ public IActionResult Error() { return View(); } + + public IActionResult android() + { + return View(); + } + + public IActionResult apple() + { + return View(); + } + + public IActionResult houtai() + { + return View(); + } } } diff --git a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml index 2a5d070..20d343b 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml @@ -88,7 +88,7 @@

-              +             ck="" />

diff --git a/CC98.Software/src/CC98.Software/Views/Home/About.cshtml b/CC98.Software/src/CC98.Software/Views/Home/desktop.cshtml similarity index 100% rename from CC98.Software/src/CC98.Software/Views/Home/About.cshtml rename to CC98.Software/src/CC98.Software/Views/Home/desktop.cshtml diff --git a/CC98.Software/src/CC98.Software/Views/Home/Contact.cshtml b/CC98.Software/src/CC98.Software/Views/Home/game.cshtml similarity index 100% rename from CC98.Software/src/CC98.Software/Views/Home/Contact.cshtml rename to CC98.Software/src/CC98.Software/Views/Home/game.cshtml diff --git a/CC98.Software/src/CC98.Software/Views/Home/houtai.cshtml b/CC98.Software/src/CC98.Software/Views/Home/houtai.cshtml index 551eb45..9e15345 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/houtai.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/houtai.cshtml @@ -6,8 +6,13 @@ - - + + + + + + + diff --git a/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml b/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml index 1a260eb..70aba9e 100644 --- a/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml @@ -31,8 +31,8 @@
姓名内容软件名称软件图标适用平台软件简介软件大小文件位置审核操作
+ + + + + + + + + + + + + if (i.Parent== null) + { + foreach (Category p in i.Children) + { + + + + + } + } + } + +
分类操作
+ @foreach (Category i in Model) + { + @i.Name; +
+
    @p.Name;
+ diff --git a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml index 20d343b..998fd61 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml @@ -1,4 +1,5 @@ -@{ +@model Category[] +@{ ViewData["Title"] = "首页-CC98软件站"; }
@@ -8,25 +9,19 @@

软件分类

-
视频软件
-
播放器  格式转换
-
聊天工具
-
浏览器
-
音乐软件
-
安全杀毒
-
系统工具
-
备份还原  硬件工具
-
桌面工具  数据恢复
-
系统优化  驱动工具
-
下载工具
-
办公软件
-
文档处理  办公常用
-
图像图片
-
编程工具
-
开发平台  运行库
-
辅助工具
-
行业软件
-
学习工具
+ @foreach (Category i in Model) + { + if (i.Parent==null) + { +
@i.Name
+ } + else + { +
@foreach (Category p in i.Children){ + @p.Name; + }
+ } + }
diff --git a/CC98.Software/src/CC98.Software/Views/Home/houtai.cshtml b/CC98.Software/src/CC98.Software/Views/Home/houtai.cshtml index 9e15345..02f525e 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/houtai.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/houtai.cshtml @@ -1,13 +1,12 @@ -@Model Software[] +@model Software[] -

后台审核界面

- +

后台审核界面

+ - @@ -15,19 +14,22 @@ - - - @foreach (Software i in Model) - { - - - - - - - - - } - - + + + @foreach (Software i in Model) + { + if (i.IsAccepted==false) + { + + + + + + + + + } + } + +
软件名称软件图标 适用平台 软件简介 软件大小审核操作
@i.Name@i.Photo@i.Platform@i.Introduction@i.Size@i.FileLocation
@i.Name@i.Platform@i.Introduction@i.Size@i.FileLocation
\ No newline at end of file From b06cf33bb15eece49614f6749cec1ff0d98de290 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?y=E6=96=B9=E7=AD=89=E4=BA=8E4x?= Date: Fri, 24 Mar 2017 20:02:20 +0800 Subject: [PATCH 11/38] shoujian --- .../src/CC98.Software/Controllers/HomeController.cs | 12 ++++++++++++ CC98.Software/src/CC98.Software/Data/Feedback.cs | 1 + 2 files changed, 13 insertions(+) diff --git a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs index 7df1a43..d53066d 100644 --- a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs +++ b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs @@ -148,5 +148,17 @@ public IActionResult New2Category(string name, int id, [FromServices] SoftwareDb m.Parent = n; return RedirectToAction("houtai"); } + + public IActionResult SendMessage(string content,string recieverName,int senderid,string title, [FromServices] SoftwareDbContext q) + { + Data.Feedback newmes = new Data.Feedback + { + Message = content, + RecieverName = recieverName, + Time = DateTimeOffset.Now, + Title=title, + }; + return View(); + } } } diff --git a/CC98.Software/src/CC98.Software/Data/Feedback.cs b/CC98.Software/src/CC98.Software/Data/Feedback.cs index 69f126e..ef6d3e8 100644 --- a/CC98.Software/src/CC98.Software/Data/Feedback.cs +++ b/CC98.Software/src/CC98.Software/Data/Feedback.cs @@ -5,6 +5,7 @@ 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; } From 3b6a5337b7728a9dcbb6dba118ad71ebd1018657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?y=E6=96=B9=E7=AD=89=E4=BA=8E4x?= Date: Fri, 24 Mar 2017 21:30:20 +0800 Subject: [PATCH 12/38] =?UTF-8?q?=E6=94=B6=E4=BB=B6=E7=AE=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/HomeController.cs | 28 ++++++-- .../src/CC98.Software/Data/Feedback.cs | 2 +- .../src/CC98.Software/Data/SMessage.cs | 18 +++++ .../Views/Home/MessageDetail.cshtml | 20 ++++++ .../Views/Home/Messagebox.cshtml | 69 +++++++++++++++++++ .../CC98.Software/Views/Home/houtai.cshtml | 36 +++++----- 6 files changed, 150 insertions(+), 23 deletions(-) create mode 100644 CC98.Software/src/CC98.Software/Data/SMessage.cs create mode 100644 CC98.Software/src/CC98.Software/Views/Home/MessageDetail.cshtml create mode 100644 CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml diff --git a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs index d53066d..50b0f28 100644 --- a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs +++ b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs @@ -5,6 +5,7 @@ using CC98.Software.Data; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Authorization; namespace CC98.Software.Controllers { @@ -76,7 +77,7 @@ public IActionResult houtai([FromServices] SoftwareDbContext q) Data.Software[] m; var result = from i in q.Softwares select i; m = result.ToArray(); - return View(m); ; + return View(m); } public IActionResult UnAccepted(int id, [FromServices] SoftwareDbContext q) @@ -149,15 +150,32 @@ public IActionResult New2Category(string name, int id, [FromServices] SoftwareDb return RedirectToAction("houtai"); } - public IActionResult SendMessage(string content,string recieverName,int senderid,string title, [FromServices] SoftwareDbContext q) + [Authorize] + public IActionResult SendMessage(SMessage p, [FromServices] SoftwareDbContext q) { + + Data.Feedback newmes = new Data.Feedback { - Message = content, - RecieverName = recieverName, + Message = p.Content, + ReceiverName = p.receivername, Time = DateTimeOffset.Now, - Title=title, + Title = p.Title, + SenderName = User.Identity.Name, }; + q.Feedbacks.Add(newmes); + return RedirectToAction("Messagebox"); + } + public IActionResult Messagebox([FromServices] SoftwareDbContext q) + { + Data.Feedback[] m; + string name = User.Identity.Name; + var result = from i in q.Feedbacks where i.ReceiverName==name||i.SenderName==name select i; + m = result.ToArray(); + return View(m); + } + public IActionResult MessageDetail([FromServices] SoftwareDbContext q) + { return View(); } } diff --git a/CC98.Software/src/CC98.Software/Data/Feedback.cs b/CC98.Software/src/CC98.Software/Data/Feedback.cs index ef6d3e8..d5fb2c8 100644 --- a/CC98.Software/src/CC98.Software/Data/Feedback.cs +++ b/CC98.Software/src/CC98.Software/Data/Feedback.cs @@ -9,6 +9,6 @@ public class Feedback public string Message { get; set; } public DateTimeOffset Time { get; set; } public string SenderName { get; set; } - public string RecieverName { get;set; } + public string ReceiverName { get;set; } } } \ No newline at end of file diff --git a/CC98.Software/src/CC98.Software/Data/SMessage.cs b/CC98.Software/src/CC98.Software/Data/SMessage.cs new file mode 100644 index 0000000..38f4339 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Data/SMessage.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace CC98.Software.Data +{ + public class SMessage + { + public string Content + { + get; set; + } + public string Title { get; set; } + public int id { get; set; } + public string receivername { get; set; } + } +} diff --git a/CC98.Software/src/CC98.Software/Views/Home/MessageDetail.cshtml b/CC98.Software/src/CC98.Software/Views/Home/MessageDetail.cshtml new file mode 100644 index 0000000..99067a1 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Views/Home/MessageDetail.cshtml @@ -0,0 +1,20 @@ + +@model Feedback +@{ +} +
+

详细信息

+ + + + + + + + + + + + +
标题发信人收信人日期详情
+
\ No newline at end of file diff --git a/CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml new file mode 100644 index 0000000..8aed2d3 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml @@ -0,0 +1,69 @@ +@model Feedback[] + +
+
+

Send Message

+
+
+ +
+
+
+
+ + +
+
+ + +
+
+ + +
+ +
+
+
+
+
+
+ + + + + + @foreach (Feedback i in Model) + { + if (i.SenderName == User.Identity.Name) + { + + + + } + + + } +
标题收件人
@i.Title @i.ReceiverName
+
+
+
+
+ + + + + + @foreach (Feedback i in Model) + { + if (i.ReceiverName == User.Identity.Name) + { + + + + + } + } +
标题发件人
@i.Title @i.SenderName
+
+
diff --git a/CC98.Software/src/CC98.Software/Views/Home/houtai.cshtml b/CC98.Software/src/CC98.Software/Views/Home/houtai.cshtml index 02f525e..ea9759f 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/houtai.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/houtai.cshtml @@ -2,23 +2,24 @@

后台审核界面

- - - - - - - - - - - - - + + +
软件名称适用平台软件简介软件大小文件位置审核操作
+ + + + + + + + + + + @foreach (Software i in Model) { - if (i.IsAccepted==false) + if (i.IsAccepted == false) { @@ -26,10 +27,11 @@ - + } } - -
软件名称适用平台软件简介软件大小文件位置审核操作
@i.Name@i.Introduction @i.Size @i.FileLocation
\ No newline at end of file + + + \ No newline at end of file From 9eaca01852b29aef76fcaf4cae3aa5c4b169a9d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?y=E6=96=B9=E7=AD=89=E4=BA=8E4x?= Date: Mon, 27 Mar 2017 22:47:15 +0800 Subject: [PATCH 13/38] =?UTF-8?q?=E9=82=A3=E5=A4=A9=E6=99=9A=E4=B8=8A?= =?UTF-8?q?=E5=81=9A=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/HomeController.cs | 12 +- .../Migrations/20170324135607_b.Designer.cs | 105 ++++++++++++++++++ .../Migrations/20170324135607_b.cs | 34 ++++++ .../SoftwareDbContextModelSnapshot.cs | 6 +- .../Views/Home/MessageDetail.cshtml | 11 +- .../Views/Home/Messagebox.cshtml | 2 +- .../CC98.Software/Views/Home/houtai.cshtml | 7 +- 7 files changed, 164 insertions(+), 13 deletions(-) create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170324135607_b.Designer.cs create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170324135607_b.cs diff --git a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs index 50b0f28..032aec4 100644 --- a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs +++ b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs @@ -170,13 +170,19 @@ public IActionResult Messagebox([FromServices] SoftwareDbContext q) { Data.Feedback[] m; string name = User.Identity.Name; - var result = from i in q.Feedbacks where i.ReceiverName==name||i.SenderName==name select i; + var result = from i in q.Feedbacks where (i.ReceiverName==name||i.SenderName==name) select i; m = result.ToArray(); return View(m); } - public IActionResult MessageDetail([FromServices] SoftwareDbContext q) + public IActionResult MessageDetail(int id,[FromServices] SoftwareDbContext q) { - return View(); + Data.Feedback m = q.Feedbacks.Find(id); + return View(m); + } + public IActionResult download(int id,[FromServices] SoftwareDbContext q) + { + Data.Software m = q.Softwares.Find(id); + return View(m); } } } 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/SoftwareDbContextModelSnapshot.cs b/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs index 87a590e..52ad584 100644 --- a/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs +++ b/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs @@ -13,7 +13,7 @@ partial class SoftwareDbContextModelSnapshot : ModelSnapshot protected override void BuildModel(ModelBuilder modelBuilder) { modelBuilder - .HasAnnotation("ProductVersion", "1.1.0-rtm-22752") + .HasAnnotation("ProductVersion", "1.1.1") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("CC98.Software.Data.Category", b => @@ -39,12 +39,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Message"); - b.Property("RecieverName"); + b.Property("ReceiverName"); b.Property("SenderName"); b.Property("Time"); + b.Property("Title"); + b.HasKey("Id"); b.ToTable("Feedbacks"); diff --git a/CC98.Software/src/CC98.Software/Views/Home/MessageDetail.cshtml b/CC98.Software/src/CC98.Software/Views/Home/MessageDetail.cshtml index 99067a1..18f2a41 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/MessageDetail.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/MessageDetail.cshtml @@ -12,9 +12,12 @@ 日期 详情 - - - - + + @Model.Title; + @Model.SenderName + @Model.SenderName + @Model.Time + @Model.Message +
\ No newline at end of file diff --git a/CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml index 8aed2d3..a38b41d 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml @@ -59,7 +59,7 @@ if (i.ReceiverName == User.Identity.Name) { - @i.Title + @i.Title @i.SenderName } diff --git a/CC98.Software/src/CC98.Software/Views/Home/houtai.cshtml b/CC98.Software/src/CC98.Software/Views/Home/houtai.cshtml index ea9759f..9e10274 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/houtai.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/houtai.cshtml @@ -3,7 +3,7 @@

后台审核界面

-
+ @@ -15,19 +15,20 @@ - @foreach (Software i in Model) { if (i.IsAccepted == false) { + - + + } } From 92206a2e0c29f21c80cb897c69ca98e6102a59b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E7=8F=BA=20=E7=94=B0?= Date: Fri, 31 Mar 2017 17:06:53 +0800 Subject: [PATCH 14/38] =?UTF-8?q?website=E6=9B=B4=E6=96=B0=20=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E9=A6=96=E9=A1=B5master?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/HomeController.cs | 27 +--- .../src/CC98.Software/Data/Comment.cs | 16 ++ .../src/CC98.Software/Data/SMessage.cs | 4 +- .../src/CC98.Software/Data/Software.cs | 3 +- .../Views/Home/AfterUploading.html | 6 +- .../Home/{houtai.cshtml => Background.cshtml} | 0 .../Views/Home/CategoryManagement.cshtml | 67 +++++---- .../Home/{download.cshtml => Details.cshtml} | 33 ++-- .../src/CC98.Software/Views/Home/List.cshtml | 76 ++++++++++ .../CC98.Software/Views/Home/android.cshtml | 5 - .../src/CC98.Software/Views/Home/apple.cshtml | 5 - .../CC98.Software/Views/Home/desktop.cshtml | 7 - .../src/CC98.Software/Views/Home/game.cshtml | 17 --- .../CC98.Software/Views/Home/search.cshtml | 142 ------------------ 14 files changed, 144 insertions(+), 264 deletions(-) create mode 100644 CC98.Software/src/CC98.Software/Data/Comment.cs rename CC98.Software/src/CC98.Software/Views/Home/{houtai.cshtml => Background.cshtml} (100%) rename CC98.Software/src/CC98.Software/Views/Home/{download.cshtml => Details.cshtml} (74%) create mode 100644 CC98.Software/src/CC98.Software/Views/Home/List.cshtml delete mode 100644 CC98.Software/src/CC98.Software/Views/Home/android.cshtml delete mode 100644 CC98.Software/src/CC98.Software/Views/Home/apple.cshtml delete mode 100644 CC98.Software/src/CC98.Software/Views/Home/desktop.cshtml delete mode 100644 CC98.Software/src/CC98.Software/Views/Home/game.cshtml delete mode 100644 CC98.Software/src/CC98.Software/Views/Home/search.cshtml diff --git a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs index 032aec4..058bd45 100644 --- a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs +++ b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs @@ -19,13 +19,6 @@ public IActionResult Index( [FromServices] SoftwareDbContext q) return View(m); ; } - public IActionResult desktop() - { - 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)); @@ -50,29 +43,15 @@ public IActionResult Upload(UploadWare m, [FromServices] SoftwareDbContext q) return View(); } - public IActionResult game() - { - ViewData["Message"] = "Your contact page."; - return View(); - } public IActionResult Error() { return View(); } - public IActionResult android() - { - return View(); - } - - public IActionResult apple() - { - return View(); - } - public IActionResult houtai([FromServices] SoftwareDbContext q) + public IActionResult Background([FromServices] SoftwareDbContext q) { Data.Software[] m; var result = from i in q.Softwares select i; @@ -158,7 +137,7 @@ public IActionResult SendMessage(SMessage p, [FromServices] SoftwareDbContext q) Data.Feedback newmes = new Data.Feedback { Message = p.Content, - ReceiverName = p.receivername, + ReceiverName = p.Receivername, Time = DateTimeOffset.Now, Title = p.Title, SenderName = User.Identity.Name, @@ -179,7 +158,7 @@ public IActionResult MessageDetail(int id,[FromServices] SoftwareDbContext q) Data.Feedback m = q.Feedbacks.Find(id); return View(m); } - public IActionResult download(int id,[FromServices] SoftwareDbContext q) + public IActionResult Details(int id,[FromServices] SoftwareDbContext q) { Data.Software m = q.Softwares.Find(id); return View(m); 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..b8f2a3f --- /dev/null +++ b/CC98.Software/src/CC98.Software/Data/Comment.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace CC98.Software.Data +{ + public class Comment + { + public string Contents { get; set; } + public DateTime Commenttime { get; set; } + public Software CommentBelongto { get; set; } + public string Name { get; set; } +} + +} diff --git a/CC98.Software/src/CC98.Software/Data/SMessage.cs b/CC98.Software/src/CC98.Software/Data/SMessage.cs index 38f4339..c9842d3 100644 --- a/CC98.Software/src/CC98.Software/Data/SMessage.cs +++ b/CC98.Software/src/CC98.Software/Data/SMessage.cs @@ -12,7 +12,7 @@ public string Content get; set; } public string Title { get; set; } - public int id { get; set; } - public string receivername { get; set; } + public int Id { get; set; } + public string Receivername { get; set; } } } diff --git a/CC98.Software/src/CC98.Software/Data/Software.cs b/CC98.Software/src/CC98.Software/Data/Software.cs index a541941..f83e9fc 100644 --- a/CC98.Software/src/CC98.Software/Data/Software.cs +++ b/CC98.Software/src/CC98.Software/Data/Software.cs @@ -69,6 +69,7 @@ public string FileLocation { get; set; } - + public string Uploadername { + get;set;} } } diff --git a/CC98.Software/src/CC98.Software/Views/Home/AfterUploading.html b/CC98.Software/src/CC98.Software/Views/Home/AfterUploading.html index 5a5eb91..895c297 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/AfterUploading.html +++ b/CC98.Software/src/CC98.Software/Views/Home/AfterUploading.html @@ -1,10 +1,6 @@ - - + - 上传中...请稍候 - - \ No newline at end of file diff --git a/CC98.Software/src/CC98.Software/Views/Home/houtai.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Background.cshtml similarity index 100% rename from CC98.Software/src/CC98.Software/Views/Home/houtai.cshtml rename to CC98.Software/src/CC98.Software/Views/Home/Background.cshtml diff --git a/CC98.Software/src/CC98.Software/Views/Home/CategoryManagement.cshtml b/CC98.Software/src/CC98.Software/Views/Home/CategoryManagement.cshtml index b094098..52f79a8 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/CategoryManagement.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/CategoryManagement.cshtml @@ -1,36 +1,39 @@ @model Category [] @{ -} -
审核操作
@i.Name @i.Platform @i.Introduction @i.Size @i.FileLocation通过不通过
- - - - - - - - - - - - - if (i.Parent== null) - { - foreach (Category p in i.Children) - { - - - - - } - } - } - -
分类操作
- @foreach (Category i in Model) - { - @i.Name; -
-
    @p.Name;
+}
+ + + + + + + + + + @foreach (Category i in Model) + { + @i.Name; + + + + + + + if (i.Parent == null) + { + foreach (Category p in i.Children) + { + + + + + } + } + } + + +
分类操作
    @p.Name;
+
+ diff --git a/CC98.Software/src/CC98.Software/Views/Home/download.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml similarity index 74% rename from CC98.Software/src/CC98.Software/Views/Home/download.cshtml rename to CC98.Software/src/CC98.Software/Views/Home/Details.cshtml index 9215cae..d0a2457 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/download.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml @@ -17,41 +17,41 @@
-
简介
+
@Model.Introduction
简介
-
游戏贴图
+
游戏贴图
//有图片地址
...
...
...
-
大小
+
@Model.Size
大小
-
类别
+
@Model.Class
类别
-
上传时间
+
@Model.UpdateTime
时间
-
上传者
+
@Model.Uploadername
上传者
-
下载数
+
@Model.DownloadNum
下载数
- +//分页
评论数
评论数
@@ -70,28 +70,13 @@
-
评论者
-
-
内容
-
时间
-
-
- -
-
评论者
+
内容
时间
-
-
评论者
-
-
内容
-
时间
-
-
diff --git a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml new file mode 100644 index 0000000..c4ef32e --- /dev/null +++ b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml @@ -0,0 +1,76 @@ + +

+

+

+
+ +
+
+
+
+
+ + +
+ +
+
+
+ +
+

+

+
+
+ +
+ +
+
+
...
+
+ 内容 +

下载数 评论数

+
+
+ + +
+
+

+
+
+

+
+
+ 热门应用 +
应用 +
应用 +
+
+ + + +
+
+
+ + 当前页码 + +
+
+
+
+ 1  + n +
+
+
+ +
+
+ + + + + diff --git a/CC98.Software/src/CC98.Software/Views/Home/android.cshtml b/CC98.Software/src/CC98.Software/Views/Home/android.cshtml deleted file mode 100644 index 613bfd7..0000000 --- a/CC98.Software/src/CC98.Software/Views/Home/android.cshtml +++ /dev/null @@ -1,5 +0,0 @@ -@* - For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 -*@ -@{ -} diff --git a/CC98.Software/src/CC98.Software/Views/Home/apple.cshtml b/CC98.Software/src/CC98.Software/Views/Home/apple.cshtml deleted file mode 100644 index 613bfd7..0000000 --- a/CC98.Software/src/CC98.Software/Views/Home/apple.cshtml +++ /dev/null @@ -1,5 +0,0 @@ -@* - For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 -*@ -@{ -} diff --git a/CC98.Software/src/CC98.Software/Views/Home/desktop.cshtml b/CC98.Software/src/CC98.Software/Views/Home/desktop.cshtml deleted file mode 100644 index 50476d1..0000000 --- a/CC98.Software/src/CC98.Software/Views/Home/desktop.cshtml +++ /dev/null @@ -1,7 +0,0 @@ -@{ - ViewData["Title"] = "About"; -} -

@ViewData["Title"].

-

@ViewData["Message"]

- -

Use this area to provide additional information.

diff --git a/CC98.Software/src/CC98.Software/Views/Home/game.cshtml b/CC98.Software/src/CC98.Software/Views/Home/game.cshtml deleted file mode 100644 index 15c12c6..0000000 --- a/CC98.Software/src/CC98.Software/Views/Home/game.cshtml +++ /dev/null @@ -1,17 +0,0 @@ -@{ - ViewData["Title"] = "Contact"; -} -

@ViewData["Title"].

-

@ViewData["Message"]

- -
- One Microsoft Way
- Redmond, WA 98052-6399
- P: - 425.555.0100 -
- -
- Support: Support@example.com
- Marketing: Marketing@example.com -
diff --git a/CC98.Software/src/CC98.Software/Views/Home/search.cshtml b/CC98.Software/src/CC98.Software/Views/Home/search.cshtml deleted file mode 100644 index 1e5a2d8..0000000 --- a/CC98.Software/src/CC98.Software/Views/Home/search.cshtml +++ /dev/null @@ -1,142 +0,0 @@ -@{ - ViewData["Title"] = ""; -} - - - - - - - - Bootstrap 101 Template - - - - - - - - - -

-

-

-
- -
-
-
-
-
- - -
- -
-
-
- -
-

-

-
-
- -
- -
-
-
...
-
- 内容 -

下载数 评论数

-
-
- -
- -
-
-
...
-
- 内容 -

下载数 评论数

-
-
- -
- -
-
-
...
-
- 内容 -

下载数 评论数

-
-
- -
- -
-
-
...
-
- 内容 -

下载数 评论数

-
-
- -
- -
-
-
...
-
- 内容 -

下载数 评论数

-
-
-
-
-
-

-
-
-

-
-
- 热门应用 -
应用 -
应用 -
-
- - - -
-
-
- - 当前页码 - -
-
-
-
- 1  - n -
-
-
- -
-
- - - - - - \ No newline at end of file From 624844c3832b434fc03df56b2c8f909d33980e92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?y=E6=96=B9=E7=AD=89=E4=BA=8E4x?= Date: Fri, 31 Mar 2017 18:54:24 +0800 Subject: [PATCH 15/38] mm --- .../Controllers/HomeController.cs | 31 ++++++++------- .../src/CC98.Software/Data/Category.cs | 7 ++-- .../src/CC98.Software/Data/Comment.cs | 4 ++ .../src/CC98.Software/Data/Setting.cs | 15 +++++++ .../src/CC98.Software/Data/Software.cs | 16 ++++++-- CC98.Software/src/CC98.Software/Startup.cs | 2 + .../Views/Home/CategoryManagement.cshtml | 4 +- .../src/CC98.Software/Views/Home/Index.cshtml | 34 ++++------------ .../Home/{Upload.cshtml => ShowUpload.cshtml} | 6 +-- .../src/CC98.Software/appsettings.json | 39 +++++++++++-------- 10 files changed, 88 insertions(+), 70 deletions(-) create mode 100644 CC98.Software/src/CC98.Software/Data/Setting.cs rename CC98.Software/src/CC98.Software/Views/Home/{Upload.cshtml => ShowUpload.cshtml} (87%) diff --git a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs index 058bd45..9dde44f 100644 --- a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs +++ b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs @@ -6,17 +6,18 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Authorization; +using Microsoft.Extensions.Options; namespace CC98.Software.Controllers { public class HomeController : Controller { - public IActionResult Index( [FromServices] SoftwareDbContext q) + public IActionResult Index([FromServices] SoftwareDbContext q) { Data.Category[] m; var result = from i in q.Categories select i; m = result.ToArray(); - return View(m); ; + return View(m); } public IActionResult Upload(UploadWare m, [FromServices] SoftwareDbContext q) @@ -31,15 +32,17 @@ public IActionResult Upload(UploadWare m, [FromServices] SoftwareDbContext q) Introduction = m.Introduction, 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("AfterUploading"); + } + public IActionResult ShowUpload() + { return View(); } @@ -56,7 +59,7 @@ public IActionResult Background([FromServices] SoftwareDbContext q) Data.Software[] m; var result = from i in q.Softwares select i; m = result.ToArray(); - return View(m); + return View(m); } public IActionResult UnAccepted(int id, [FromServices] SoftwareDbContext q) @@ -86,14 +89,14 @@ public IActionResult Accepted(int id, [FromServices] SoftwareDbContext q) { m.IsAccepted = true; } - return RedirectToAction("houtai"); + return RedirectToAction("Background"); } public IActionResult NewCategory(string name, [FromServices] SoftwareDbContext q) { Data.Category m = new Category(); m.Name = name; - return RedirectToAction("houtai"); + return RedirectToAction("Background"); } public IActionResult Delete(int id, [FromServices] SoftwareDbContext q) @@ -113,8 +116,8 @@ public IActionResult Delete(int id, [FromServices] SoftwareDbContext q) public IActionResult CategoryManagement([FromServices] SoftwareDbContext q) { - Category[] m; - var result = from i in q.Categories select i; + Category[] m; + var result = from i in q.Categories select i; m = result.ToArray(); return View(m); ; } @@ -126,13 +129,13 @@ public IActionResult New2Category(string name, int id, [FromServices] SoftwareDb n = q.Categories.Find(id); m.Name = name; m.Parent = n; - return RedirectToAction("houtai"); + return RedirectToAction("Background"); } [Authorize] public IActionResult SendMessage(SMessage p, [FromServices] SoftwareDbContext q) { - + Data.Feedback newmes = new Data.Feedback { @@ -149,16 +152,16 @@ public IActionResult Messagebox([FromServices] SoftwareDbContext q) { Data.Feedback[] m; string name = User.Identity.Name; - var result = from i in q.Feedbacks where (i.ReceiverName==name||i.SenderName==name) select i; + var result = from i in q.Feedbacks where (i.ReceiverName == name || i.SenderName == name) select i; m = result.ToArray(); return View(m); } - public IActionResult MessageDetail(int id,[FromServices] SoftwareDbContext q) + public IActionResult MessageDetail(int id, [FromServices] SoftwareDbContext q) { Data.Feedback m = q.Feedbacks.Find(id); return View(m); } - public IActionResult Details(int id,[FromServices] SoftwareDbContext q) + public IActionResult Details(int id, [FromServices] SoftwareDbContext q) { Data.Software m = q.Softwares.Find(id); return View(m); diff --git a/CC98.Software/src/CC98.Software/Data/Category.cs b/CC98.Software/src/CC98.Software/Data/Category.cs index 0779d74..7a5d07d 100644 --- a/CC98.Software/src/CC98.Software/Data/Category.cs +++ b/CC98.Software/src/CC98.Software/Data/Category.cs @@ -10,6 +10,8 @@ public int Id { get; set; } + [InverseProperty("Parent")] + public virtual ICollection Children { get; set; } = new Collection(); public string Name { @@ -20,9 +22,8 @@ public Category Parent { get; set; } - - [InverseProperty("Parent")] - public virtual ICollection Children { get; set; } = new Collection(); + [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 index b8f2a3f..dd0f307 100644 --- a/CC98.Software/src/CC98.Software/Data/Comment.cs +++ b/CC98.Software/src/CC98.Software/Data/Comment.cs @@ -2,6 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations.Schema; + namespace CC98.Software.Data { @@ -11,6 +14,7 @@ public class Comment public DateTime Commenttime { get; set; } public Software CommentBelongto { get; set; } public string Name { get; set; } + public int Id { 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..f24a703 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Data/Setting.cs @@ -0,0 +1,15 @@ +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; } + } + +} diff --git a/CC98.Software/src/CC98.Software/Data/Software.cs b/CC98.Software/src/CC98.Software/Data/Software.cs index f83e9fc..5d2592d 100644 --- a/CC98.Software/src/CC98.Software/Data/Software.cs +++ b/CC98.Software/src/CC98.Software/Data/Software.cs @@ -3,6 +3,8 @@ using System.IO; using System.Linq; using System.Threading.Tasks; +using System.Collections.ObjectModel; +using System.ComponentModel.DataAnnotations.Schema; namespace CC98.Software.Data { @@ -13,8 +15,8 @@ public class Software /// public bool IsAccepted { - get; set; - + get; set; + } public bool IsFrequent { @@ -69,7 +71,13 @@ public string FileLocation { get; set; } - public string Uploadername { - get;set;} + public string Uploadername + { + get; set; + } + + [InverseProperty("CommentBelongto")] + public virtual ICollection Comments { get; set; } = new Collection(); + } } diff --git a/CC98.Software/src/CC98.Software/Startup.cs b/CC98.Software/src/CC98.Software/Startup.cs index 8619921..214124e 100644 --- a/CC98.Software/src/CC98.Software/Startup.cs +++ b/CC98.Software/src/CC98.Software/Startup.cs @@ -58,6 +58,8 @@ public Startup(IHostingEnvironment env) [UsedImplicitly] public void ConfigureServices(IServiceCollection services) { + services.Configure(Configuration.GetSection("WebsiteAddress")); + // 添加数据库功能 services.AddDbContext(options => { diff --git a/CC98.Software/src/CC98.Software/Views/Home/CategoryManagement.cshtml b/CC98.Software/src/CC98.Software/Views/Home/CategoryManagement.cshtml index 52f79a8..c4460f1 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/CategoryManagement.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/CategoryManagement.cshtml @@ -1,7 +1,7 @@ @model Category [] @{ -}
+} @@ -16,7 +16,7 @@ @i.Name; - + diff --git a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml index 998fd61..8e84b6e 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml @@ -1,4 +1,6 @@ -@model Category[] +@using Microsoft.Extensions.Options +@inject IOptions Setting +@model Category[] @{ ViewData["Title"] = "首页-CC98软件站"; } @@ -26,29 +28,7 @@

常用软件集合

-
-
安全上网
-
测试ING    测试ING    测试ING    测试ING    测试ING
-
测试ING    测试ING    测试ING    测试ING    测试ING
-
测试ING    测试ING    测试ING    测试ING    测试ING
-
安全上98
-
测试ING    测试ING    测试ING    测试ING    测试ING
-
测试ING    测试ING    测试ING    测试ING    测试ING
-
测试ING    测试ING    测试ING    测试ING    测试ING
-
安全下载
-
测试ING    测试ING    测试ING    测试ING    测试ING
-
测试ING    测试ING    测试ING    测试ING    测试ING
-
测试ING    测试ING    测试ING    测试ING    测试ING
-
快乐上网
-
测试ING    测试ING    测试ING    测试ING    测试ING
-
测试ING    测试ING    测试ING    测试ING    测试ING
-
测试ING    测试ING    测试ING    测试ING    测试ING
-
就要玩游戏
-
测试ING    测试ING    测试ING    测试ING    测试ING
-
测试ING    测试ING    测试ING    测试ING    测试ING
- - -
+
@@ -75,15 +55,15 @@

用户专区

-              +       我要上传       求未收录软件

-              +       我要反馈      

-             ck="" /> +       FTP上传工具      

diff --git a/CC98.Software/src/CC98.Software/Views/Home/Upload.cshtml b/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml similarity index 87% rename from CC98.Software/src/CC98.Software/Views/Home/Upload.cshtml rename to CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml index 4b60dac..b609007 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Upload.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml @@ -1,7 +1,7 @@ @* For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 *@ -@model Software +@model UploadWare @{ /*功能主要包括: 需要用户登录 @@ -9,7 +9,7 @@ (1.软件名称2.软件图标3.软件分类4.软件适用平台5.软件功能简介6.安装说明7.文件的ftp地址 2.http上传模式 除了以上表单内容除第七项以外,新增上传界面(推荐小文件上传)*/ } - + 上传文件

上传软件图标
@@ -20,5 +20,5 @@ Mac Android Ios
-
+
\ No newline at end of file diff --git a/CC98.Software/src/CC98.Software/appsettings.json b/CC98.Software/src/CC98.Software/appsettings.json index 53ff5da..03f59aa 100644 --- a/CC98.Software/src/CC98.Software/appsettings.json +++ b/CC98.Software/src/CC98.Software/appsettings.json @@ -1,19 +1,24 @@ { - "Logging": { - "IncludeScopes": false, - "LogLevel": { - "Default": "Debug", - "System": "Information", - "Microsoft": "Information" - } - }, - "ConnectionStrings": { - "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=CC98-Software;" - }, - "Authentication": { - "CC98": { - "ClientId": "87a84a20-d041-48b1-876b-b842c401bc05", - "ClientSecret": "38666cce-cc10-4e3e-a73b-eb94b8d288e6" - } - } + "Logging": { + "IncludeScopes": false, + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + }, + "ConnectionStrings": { + "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=CC98-Software;" + }, + "Authentication": { + "CC98": { + "ClientId": "87a84a20-d041-48b1-876b-b842c401bc05", + "ClientSecret": "38666cce-cc10-4e3e-a73b-eb94b8d288e6" + } + }, + "WebsiteAddress":{ + "FeedbackWeb": "http://www.baidu.com", + "RequireWeb":"http://www.hao123.com" + } } + From 31de7e0b3caad8d409b14605414febc6f92bca6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E7=8F=BA=20=E7=94=B0?= Date: Fri, 31 Mar 2017 21:40:02 +0800 Subject: [PATCH 16/38] 111 --- .../src/CC98.Software/Data/Manager.cs | 13 ++++++++++++ .../CC98.Software/Data/SoftwareDbContext.cs | 3 +++ .../FrequentSoftwaresViewComponent.cs | 21 +++++++++++++++++++ .../CC98.Software/Views/Home/Details.cshtml | 5 +++-- .../src/CC98.Software/Views/Home/Index.cshtml | 2 +- .../FrequentSoftwares/Default.cshtml | 3 +++ 6 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 CC98.Software/src/CC98.Software/Data/Manager.cs create mode 100644 CC98.Software/src/CC98.Software/FrequentSoftwaresViewComponent.cs create mode 100644 CC98.Software/src/CC98.Software/Views/Shared/Components/FrequentSoftwares/Default.cshtml diff --git a/CC98.Software/src/CC98.Software/Data/Manager.cs b/CC98.Software/src/CC98.Software/Data/Manager.cs new file mode 100644 index 0000000..e94cd34 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Data/Manager.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace CC98.Software.Data +{ + public class Manager + { + public string Name { get; set; } + public int Id { get; set; } + } +} diff --git a/CC98.Software/src/CC98.Software/Data/SoftwareDbContext.cs b/CC98.Software/src/CC98.Software/Data/SoftwareDbContext.cs index d320523..232eb72 100644 --- a/CC98.Software/src/CC98.Software/Data/SoftwareDbContext.cs +++ b/CC98.Software/src/CC98.Software/Data/SoftwareDbContext.cs @@ -29,5 +29,8 @@ public SoftwareDbContext(DbContextOptions options) : base(opt public virtual DbSet Softwares { get; set; } public virtual DbSet Categories { get; set; } public virtual DbSet Feedbacks { get; set; } + public virtual DbSet Comments { get; set; } + public virtual DbSet Managers { get; set; } + public virtual DbSet SMessages { get; set; } } } diff --git a/CC98.Software/src/CC98.Software/FrequentSoftwaresViewComponent.cs b/CC98.Software/src/CC98.Software/FrequentSoftwaresViewComponent.cs new file mode 100644 index 0000000..036b597 --- /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 q) + { + Data.Software[] m; + var result = from i in q.Softwares where i.IsFrequent select i; + m = result.ToArray(); + return View(m); + } + } + +} diff --git a/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml index d0a2457..560f9c6 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml @@ -72,8 +72,9 @@
-
内容
-
时间
+ @foreach (var i in @Model.Comments) { +
@i.Contents
+
@i.Commenttime
}
diff --git a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml index 8e84b6e..20b5439 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml @@ -28,7 +28,7 @@

常用软件集合

- +
diff --git a/CC98.Software/src/CC98.Software/Views/Shared/Components/FrequentSoftwares/Default.cshtml b/CC98.Software/src/CC98.Software/Views/Shared/Components/FrequentSoftwares/Default.cshtml new file mode 100644 index 0000000..65c9e0d --- /dev/null +++ b/CC98.Software/src/CC98.Software/Views/Shared/Components/FrequentSoftwares/Default.cshtml @@ -0,0 +1,3 @@ + +@{ +} From d8be5e0c030d427eea7694f2154898ec739beb16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?y=E6=96=B9=E7=AD=89=E4=BA=8E4x?= Date: Fri, 31 Mar 2017 21:41:57 +0800 Subject: [PATCH 17/38] 2 --- .../Controllers/HomeController.cs | 14 ++ .../src/CC98.Software/Data/Software.cs | 4 +- .../20170331130534_331update.Designer.cs | 134 ++++++++++++++++++ .../Migrations/20170331130534_331update.cs | 55 +++++++ .../SoftwareDbContextModelSnapshot.cs | 31 +++- .../Views/Home/Background.cshtml | 2 +- .../Views/Home/CategoryManagement.cshtml | 10 +- .../src/CC98.Software/Views/Home/Index.cshtml | 23 +-- .../src/CC98.Software/Views/Home/List.cshtml | 69 +++++---- 9 files changed, 292 insertions(+), 50 deletions(-) create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170331130534_331update.Designer.cs create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170331130534_331update.cs diff --git a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs index 9dde44f..00b9240 100644 --- a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs +++ b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs @@ -12,6 +12,7 @@ namespace CC98.Software.Controllers { public class HomeController : Controller { + public int amount; public IActionResult Index([FromServices] SoftwareDbContext q) { Data.Category[] m; @@ -166,5 +167,18 @@ public IActionResult Details(int id, [FromServices] SoftwareDbContext q) Data.Software m = q.Softwares.Find(id); return View(m); } + public IActionResult List(int classid,int page,[FromServices] SoftwareDbContext q) + { + page++; + Data.Software[] a; + var b = from i in q.Softwares where i.Class.Id == 1 select i; + amount = b.Count(); + var c=b.Skip(10*(page-1)).Take(10); + a = c.ToArray(); + ViewBag(amount); + ViewBag(classid); + return View(a); + + } } } diff --git a/CC98.Software/src/CC98.Software/Data/Software.cs b/CC98.Software/src/CC98.Software/Data/Software.cs index 5d2592d..d5f302e 100644 --- a/CC98.Software/src/CC98.Software/Data/Software.cs +++ b/CC98.Software/src/CC98.Software/Data/Software.cs @@ -71,10 +71,10 @@ public string FileLocation { get; set; } - public string Uploadername + /* public string Uploadername { get; set; - } + }*/ [InverseProperty("CommentBelongto")] public virtual ICollection Comments { get; set; } = new Collection(); 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/SoftwareDbContextModelSnapshot.cs b/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs index 52ad584..106c83f 100644 --- a/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs +++ b/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs @@ -32,6 +32,26 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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") @@ -79,6 +99,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("UpdateTime"); + b.Property("Uploadername"); + b.HasKey("Id"); b.HasIndex("ClassId"); @@ -93,10 +115,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) .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() + .WithMany("Softwares") .HasForeignKey("ClassId"); }); } diff --git a/CC98.Software/src/CC98.Software/Views/Home/Background.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Background.cshtml index 9e10274..069a8b9 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Background.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Background.cshtml @@ -2,7 +2,7 @@

后台审核界面

- +
diff --git a/CC98.Software/src/CC98.Software/Views/Home/CategoryManagement.cshtml b/CC98.Software/src/CC98.Software/Views/Home/CategoryManagement.cshtml index c4460f1..4345047 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/CategoryManagement.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/CategoryManagement.cshtml @@ -1,7 +1,7 @@ @model Category [] @{ -} +}
@@ -16,9 +16,9 @@ @i.Name; - - - + + + if (i.Parent == null) { @@ -26,7 +26,7 @@ { - + } } diff --git a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml index 8e84b6e..163a88a 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml @@ -13,24 +13,27 @@
@foreach (Category i in Model) { - if (i.Parent==null) + if (i.Parent == null) { -
@i.Name
+
@i.Name
} else { -
@foreach (Category p in i.Children){ - @p.Name; - }
+
+ @foreach (Category p in i.Children) + { + @p.Name + } +
} }

常用软件集合

- +
- +
@@ -54,7 +57,7 @@

用户专区

-

+

      我要上传       求未收录软件

@@ -71,6 +74,6 @@
-

常玩游戏下载

- hhh +

常玩游戏下载

+ hhh
diff --git a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml index c4ef32e..b1d3cee 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml @@ -1,4 +1,5 @@ - +@model Software[] +

@@ -22,51 +23,57 @@

- + @foreach (Software i in Model) + {
...
- 内容 -

下载数 评论数

+ @i.Introduction +

@i.DownloadNum 评论数

+ } - -
-
-

-
-
-

-
-
- 热门应用 -
应用 -
应用 + +
+
+

+
+
+

+
+
+ 热门应用 +
应用 +
应用 +
-
-
-
-
- - 当前页码 - +
+
+
+ + @for(int page = 1; page <= @ViewBag.amount/10+1; page++) { + + @page + } + 下一页 +
-
-
-
- 1  - n +
+
+ 1  + n +
-
-
+ +
From 3383e4f020e3485fc195905850ba5d49add2b5f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E7=8F=BA=20=E7=94=B0?= Date: Sat, 1 Apr 2017 15:17:01 +0800 Subject: [PATCH 18/38] =?UTF-8?q?vc=E5=88=86=E9=A1=B5=E5=AE=8C=E6=88=90=20?= =?UTF-8?q?detail=20list=20index=E7=BD=91=E9=A1=B5c#=E7=9A=84=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=20=E6=96=B0=E6=8E=A7=E5=88=B6=E5=99=A8testdb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/HomeController.cs | 42 ++++- .../Controllers/TestdbController.cs | 34 ++++ .../{Views/Home => Data}/Details.cshtml | 9 +- .../src/CC98.Software/Data/Software.cs | 6 +- .../HotSoftwaresViewComponent.cs | 20 +++ .../20170401051933_41update.Designer.cs | 160 ++++++++++++++++++ .../Migrations/20170401051933_41update.cs | 119 +++++++++++++ .../20170401052337_41again.Designer.cs | 160 ++++++++++++++++++ .../Migrations/20170401052337_41again.cs | 19 +++ .../Migrations/20170401053618_wtf.Designer.cs | 160 ++++++++++++++++++ .../Migrations/20170401053618_wtf.cs | 19 +++ .../Migrations/20170401071534_vc.Designer.cs | 160 ++++++++++++++++++ .../Migrations/20170401071534_vc.cs | 19 +++ .../SoftwareDbContextModelSnapshot.cs | 32 +++- .../Views/Home/Background.cshtml | 1 + .../src/CC98.Software/Views/Home/Index.cshtml | 4 +- .../src/CC98.Software/Views/Home/List.cshtml | 6 +- .../Views/Home/RecommendSoftware.cshtml | 5 + .../FrequentSoftwares/Default.cshtml | 9 +- .../Components/HotSoftwares/Default.cshtml | 7 + 20 files changed, 975 insertions(+), 16 deletions(-) create mode 100644 CC98.Software/src/CC98.Software/Controllers/TestdbController.cs rename CC98.Software/src/CC98.Software/{Views/Home => Data}/Details.cshtml (77%) create mode 100644 CC98.Software/src/CC98.Software/HotSoftwaresViewComponent.cs create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170401051933_41update.Designer.cs create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170401051933_41update.cs create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170401052337_41again.Designer.cs create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170401052337_41again.cs create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170401053618_wtf.Designer.cs create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170401053618_wtf.cs create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170401071534_vc.Designer.cs create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170401071534_vc.cs create mode 100644 CC98.Software/src/CC98.Software/Views/Home/RecommendSoftware.cshtml create mode 100644 CC98.Software/src/CC98.Software/Views/Shared/Components/HotSoftwares/Default.cshtml diff --git a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs index 00b9240..2391fb7 100644 --- a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs +++ b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs @@ -40,6 +40,7 @@ public IActionResult Upload(UploadWare m, [FromServices] SoftwareDbContext q) }; q.Softwares.Add(newfile); + q.SaveChanges(true); return View("AfterUploading"); } public IActionResult ShowUpload() @@ -75,6 +76,7 @@ public IActionResult UnAccepted(int id, [FromServices] SoftwareDbContext q) { q.Softwares.Remove(m); } + q.SaveChanges(true); return RedirectToAction("houtai"); } @@ -90,6 +92,7 @@ public IActionResult Accepted(int id, [FromServices] SoftwareDbContext q) { m.IsAccepted = true; } + q.SaveChanges(true); return RedirectToAction("Background"); } @@ -112,6 +115,7 @@ public IActionResult Delete(int id, [FromServices] SoftwareDbContext q) { q.Categories.Remove(m); } + q.SaveChanges(true); return RedirectToAction("CategoryManagement"); } @@ -130,6 +134,7 @@ public IActionResult New2Category(string name, int id, [FromServices] SoftwareDb n = q.Categories.Find(id); m.Name = name; m.Parent = n; + q.SaveChanges(true); return RedirectToAction("Background"); } @@ -147,6 +152,7 @@ public IActionResult SendMessage(SMessage p, [FromServices] SoftwareDbContext q) SenderName = User.Identity.Name, }; q.Feedbacks.Add(newmes); + q.SaveChanges(true); return RedirectToAction("Messagebox"); } public IActionResult Messagebox([FromServices] SoftwareDbContext q) @@ -155,6 +161,7 @@ public IActionResult Messagebox([FromServices] SoftwareDbContext q) string name = User.Identity.Name; var result = from i in q.Feedbacks where (i.ReceiverName == name || i.SenderName == name) select i; m = result.ToArray(); + q.SaveChanges(true); return View(m); } public IActionResult MessageDetail(int id, [FromServices] SoftwareDbContext q) @@ -172,13 +179,42 @@ public IActionResult List(int classid,int page,[FromServices] SoftwareDbContext page++; Data.Software[] a; var b = from i in q.Softwares where i.Class.Id == 1 select i; - amount = b.Count(); + ViewBag.amount = b.Count(); var c=b.Skip(10*(page-1)).Take(10); a = c.ToArray(); - ViewBag(amount); - ViewBag(classid); + ViewBag.curPage = page; + ViewBag.classid=classid; return View(a); } + public IActionResult changeFrequencyT(int id,[FromServices]Data.SoftwareDbContext q) + { + Data.Software p=q.Softwares.Find(id); + p.IsFrequent = true; + q.SaveChanges(true); + return RedirectToAction("Details"); + } + public IActionResult changeFrequencyF(int id, [FromServices]Data.SoftwareDbContext q) + { + Data.Software p = q.Softwares.Find(id); + p.IsFrequent = false; + q.SaveChanges(true); + return RedirectToAction("Details"); + } + public IActionResult changeRecommendationT(int id, [FromServices]Data.SoftwareDbContext q) + { + Data.Software p = q.Softwares.Find(id); + p.isRecommended = true; + q.SaveChanges(true); + return RedirectToAction("Details"); + } + public IActionResult changeRecommendationF(int id, [FromServices]Data.SoftwareDbContext q) + { + Data.Software p = q.Softwares.Find(id); + p.isRecommended = false; + q.SaveChanges(true); + return RedirectToAction("Details"); + } + } } 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..b971451 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Controllers/TestdbController.cs @@ -0,0 +1,34 @@ +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 q) + { + + for (int i = 1; i <= 100; i++) + { + Data.Software s = new Data.Software(); + s.Name = i.ToString(); + s.DownloadNum = 1; + s.IsAccepted = false; + s.IsFrequent = false; + s.Size = 1; + s.UpdateTime = DateTimeOffset.Now; + s.Platform = Data.Platform.Android; + q.Softwares.Add(s); + + } + q.SaveChanges(true); + return RedirectToAction("index","home"); + } + } +} diff --git a/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml b/CC98.Software/src/CC98.Software/Data/Details.cshtml similarity index 77% rename from CC98.Software/src/CC98.Software/Views/Home/Details.cshtml rename to CC98.Software/src/CC98.Software/Data/Details.cshtml index 560f9c6..647d85d 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml +++ b/CC98.Software/src/CC98.Software/Data/Details.cshtml @@ -52,6 +52,10 @@
下载数
//分页 + + + +
评论数
评论数
@@ -77,7 +81,10 @@
@i.Commenttime
}
- + + + +
diff --git a/CC98.Software/src/CC98.Software/Data/Software.cs b/CC98.Software/src/CC98.Software/Data/Software.cs index d5f302e..5864d4f 100644 --- a/CC98.Software/src/CC98.Software/Data/Software.cs +++ b/CC98.Software/src/CC98.Software/Data/Software.cs @@ -71,10 +71,12 @@ public string FileLocation { get; set; } - /* public string Uploadername + public string Uploadername { get; set; - }*/ + } + public bool isRecommended { get; set; } + [InverseProperty("CommentBelongto")] public virtual ICollection Comments { get; set; } = new Collection(); diff --git a/CC98.Software/src/CC98.Software/HotSoftwaresViewComponent.cs b/CC98.Software/src/CC98.Software/HotSoftwaresViewComponent.cs new file mode 100644 index 0000000..75188ba --- /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 q) + { + Data.Software[] m; + var result = from i in q.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/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("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/20170401053618_wtf.cs b/CC98.Software/src/CC98.Software/Migrations/20170401053618_wtf.cs new file mode 100644 index 0000000..f117ea0 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Migrations/20170401053618_wtf.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace CC98.Software.Migrations +{ + public partial class wtf : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/CC98.Software/src/CC98.Software/Migrations/20170401071534_vc.Designer.cs b/CC98.Software/src/CC98.Software/Migrations/20170401071534_vc.Designer.cs new file mode 100644 index 0000000..345d5b8 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Migrations/20170401071534_vc.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("20170401071534_vc")] + partial class vc + { + 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/20170401071534_vc.cs b/CC98.Software/src/CC98.Software/Migrations/20170401071534_vc.cs new file mode 100644 index 0000000..0979a0e --- /dev/null +++ b/CC98.Software/src/CC98.Software/Migrations/20170401071534_vc.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace CC98.Software.Migrations +{ + public partial class vc : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs b/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs index 106c83f..28dfad9 100644 --- a/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs +++ b/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs @@ -49,7 +49,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("CommentBelongtoId"); - b.ToTable("Comment"); + b.ToTable("Comments"); }); modelBuilder.Entity("CC98.Software.Data.Feedback", b => @@ -72,6 +72,34 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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") @@ -99,8 +127,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("UpdateTime"); - b.Property("Uploadername"); - b.HasKey("Id"); b.HasIndex("ClassId"); diff --git a/CC98.Software/src/CC98.Software/Views/Home/Background.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Background.cshtml index 069a8b9..ca980e1 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Background.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Background.cshtml @@ -3,6 +3,7 @@

后台审核界面

+
    @p.Name;
diff --git a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml index 163a88a..c7cd962 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml @@ -31,7 +31,9 @@

常用软件集合

- + + + //这里是引用了两个分页
diff --git a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml index b1d3cee..d29eddc 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml @@ -58,11 +58,11 @@
- @for(int page = 1; page <= @ViewBag.amount/10+1; page++) { + @for(int page = 1; page <= ViewBag.amount/10+1; page++) { - @page + @page } - 下一页 + 下一页
diff --git a/CC98.Software/src/CC98.Software/Views/Home/RecommendSoftware.cshtml b/CC98.Software/src/CC98.Software/Views/Home/RecommendSoftware.cshtml new file mode 100644 index 0000000..e1dd794 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Views/Home/RecommendSoftware.cshtml @@ -0,0 +1,5 @@ +@* + For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@{ +} diff --git a/CC98.Software/src/CC98.Software/Views/Shared/Components/FrequentSoftwares/Default.cshtml b/CC98.Software/src/CC98.Software/Views/Shared/Components/FrequentSoftwares/Default.cshtml index 65c9e0d..c6920c1 100644 --- a/CC98.Software/src/CC98.Software/Views/Shared/Components/FrequentSoftwares/Default.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Shared/Components/FrequentSoftwares/Default.cshtml @@ -1,3 +1,6 @@ - -@{ -} +@model Software[] + +@foreach (Software i in Model) +{ + @i.Name +} \ No newline at end of file diff --git a/CC98.Software/src/CC98.Software/Views/Shared/Components/HotSoftwares/Default.cshtml b/CC98.Software/src/CC98.Software/Views/Shared/Components/HotSoftwares/Default.cshtml new file mode 100644 index 0000000..aa99166 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Views/Shared/Components/HotSoftwares/Default.cshtml @@ -0,0 +1,7 @@ +@model Software[] + + @foreach(Software i in Model) + { + @i.Name + } + From a3ad26a7ca17de55ebcf7a734acb5787c4554096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E7=8F=BA=20=E7=94=B0?= Date: Fri, 7 Apr 2017 19:32:36 +0800 Subject: [PATCH 19/38] 4,7 --- .../Controllers/HomeController.cs | 18 +++++++--- .../Controllers/TestdbController.cs | 36 ++++++++++++++++--- .../src/CC98.Software/Data/Category.cs | 2 +- .../src/CC98.Software/Data/Comment.cs | 2 +- .../CC98.Software/Data/SoftwareDbContext.cs | 1 - .../src/CC98.Software/SearchViewComponent.cs | 22 ++++++++++++ .../{Data => Views/Home}/Details.cshtml | 0 .../src/CC98.Software/Views/Home/Index.cshtml | 6 +--- .../Shared/Components/Search/default.cshtml | 7 ++++ 9 files changed, 78 insertions(+), 16 deletions(-) create mode 100644 CC98.Software/src/CC98.Software/SearchViewComponent.cs rename CC98.Software/src/CC98.Software/{Data => Views/Home}/Details.cshtml (100%) create mode 100644 CC98.Software/src/CC98.Software/Views/Shared/Components/Search/default.cshtml diff --git a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs index 2391fb7..61d0150 100644 --- a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs +++ b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs @@ -174,18 +174,28 @@ public IActionResult Details(int id, [FromServices] SoftwareDbContext q) Data.Software m = q.Softwares.Find(id); return View(m); } - public IActionResult List(int classid,int page,[FromServices] SoftwareDbContext q) + public IActionResult InList(int classid, [FromServices] SoftwareDbContext q) { - page++; + Data.Software[] a; var b = from i in q.Softwares where i.Class.Id == 1 select i; ViewBag.amount = b.Count(); - var c=b.Skip(10*(page-1)).Take(10); + var c = b.Skip(10 * (page - 1)).Take(10); a = c.ToArray(); + + ViewBag.classid = classid; + return View(a); + } + public IActionResult List( int page,Data.Software[] software,[FromServices] SoftwareDbContext q) + { page++; ViewBag.curPage = page; - ViewBag.classid=classid; + ViewBag.amount = software.Count(); + var c = software.Skip(10 * (page - 1)).Take(10); + var a = c.ToArray(); + return View(a); + } public IActionResult changeFrequencyT(int id,[FromServices]Data.SoftwareDbContext q) { diff --git a/CC98.Software/src/CC98.Software/Controllers/TestdbController.cs b/CC98.Software/src/CC98.Software/Controllers/TestdbController.cs index b971451..8111bc4 100644 --- a/CC98.Software/src/CC98.Software/Controllers/TestdbController.cs +++ b/CC98.Software/src/CC98.Software/Controllers/TestdbController.cs @@ -9,11 +9,11 @@ namespace CC98.Software.Controllers { public class TestdbController : Controller - { + { // GET: // public IActionResult AddDb([FromServices]Data.SoftwareDbContext q) { - + for (int i = 1; i <= 100; i++) { Data.Software s = new Data.Software(); @@ -25,10 +25,38 @@ public IActionResult AddDb([FromServices]Data.SoftwareDbContext q) s.UpdateTime = DateTimeOffset.Now; s.Platform = Data.Platform.Android; q.Softwares.Add(s); - + + } + q.SaveChanges(true); + return RedirectToAction("index", "home"); + } + public IActionResult AddDbcomment([FromServices]Data.SoftwareDbContext q) + { + for (int i = 1; i <= 100; i++) + { + Data.Comment s = new Data.Comment(); + s.Commenttime = DateTimeOffset.Now; + s.Contents = i + "abc"; + Data.Software p = new Data.Software(); + p.Id = i / 3 + 1; + s.CommentBelongto = p; + q.Comments.Add(s); + } + q.SaveChanges(true); + return RedirectToAction("index", "home"); + } + public IActionResult AddDbfeedback([FromServices]Data.SoftwareDbContext q) + { + for (int i = 1; i <= 100; i++) + { + Data.Feedback s = new Data.Feedback(); + s.Time = DateTimeOffset.Now; + s.Title = i + "abc"; + s.Message = i + "abcdefg"; + q.Feedbacks.Add(s); } q.SaveChanges(true); - return RedirectToAction("index","home"); + return RedirectToAction("index", "home"); } } } diff --git a/CC98.Software/src/CC98.Software/Data/Category.cs b/CC98.Software/src/CC98.Software/Data/Category.cs index 7a5d07d..71045ea 100644 --- a/CC98.Software/src/CC98.Software/Data/Category.cs +++ b/CC98.Software/src/CC98.Software/Data/Category.cs @@ -17,7 +17,7 @@ public string Name { get; set; } - + public Category Parent { get; set; diff --git a/CC98.Software/src/CC98.Software/Data/Comment.cs b/CC98.Software/src/CC98.Software/Data/Comment.cs index dd0f307..e74dbf2 100644 --- a/CC98.Software/src/CC98.Software/Data/Comment.cs +++ b/CC98.Software/src/CC98.Software/Data/Comment.cs @@ -11,7 +11,7 @@ namespace CC98.Software.Data public class Comment { public string Contents { get; set; } - public DateTime Commenttime { get; set; } + public DateTimeOffset Commenttime { get; set; } public Software CommentBelongto { get; set; } public string Name { get; set; } public int Id { get; set; } diff --git a/CC98.Software/src/CC98.Software/Data/SoftwareDbContext.cs b/CC98.Software/src/CC98.Software/Data/SoftwareDbContext.cs index 232eb72..2fa697e 100644 --- a/CC98.Software/src/CC98.Software/Data/SoftwareDbContext.cs +++ b/CC98.Software/src/CC98.Software/Data/SoftwareDbContext.cs @@ -31,6 +31,5 @@ public SoftwareDbContext(DbContextOptions options) : base(opt public virtual DbSet Feedbacks { get; set; } public virtual DbSet Comments { get; set; } public virtual DbSet Managers { get; set; } - public virtual DbSet SMessages { get; set; } } } diff --git a/CC98.Software/src/CC98.Software/SearchViewComponent.cs b/CC98.Software/src/CC98.Software/SearchViewComponent.cs new file mode 100644 index 0000000..41c1d39 --- /dev/null +++ b/CC98.Software/src/CC98.Software/SearchViewComponent.cs @@ -0,0 +1,22 @@ +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 SearchViewComponent : Microsoft.AspNetCore.Mvc.ViewComponent + { + public IViewComponentResult Invoke([FromServices] Data.SoftwareDbContext q, Data.SearchModel model) + { + var x = from i in q.Softwares + + where i.Name.Contains(model.Content) + + select i; + + return View(x.ToArray()); + } + } +} diff --git a/CC98.Software/src/CC98.Software/Data/Details.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml similarity index 100% rename from CC98.Software/src/CC98.Software/Data/Details.cshtml rename to CC98.Software/src/CC98.Software/Views/Home/Details.cshtml diff --git a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml index c7cd962..20b04e2 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml @@ -36,11 +36,7 @@ //这里是引用了两个分页
-
-
- - -
+

软件排行

    diff --git a/CC98.Software/src/CC98.Software/Views/Shared/Components/Search/default.cshtml b/CC98.Software/src/CC98.Software/Views/Shared/Components/Search/default.cshtml new file mode 100644 index 0000000..5cbae2a --- /dev/null +++ b/CC98.Software/src/CC98.Software/Views/Shared/Components/Search/default.cshtml @@ -0,0 +1,7 @@ + +
    +
    + + +
    +
    \ No newline at end of file From a226548dae823d9930a32dac800b1a12408ceea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E7=8F=BA=20=E7=94=B0?= Date: Fri, 7 Apr 2017 19:39:42 +0800 Subject: [PATCH 20/38] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{Models => Data}/SearchModel.cs | 2 +- .../src/CC98.Software/Views/Home/Index.cshtml | 166 ++++++++++++------ .../Shared/Components/Search/default.cshtml | 16 +- 3 files changed, 121 insertions(+), 63 deletions(-) rename CC98.Software/src/CC98.Software/{Models => Data}/SearchModel.cs (89%) diff --git a/CC98.Software/src/CC98.Software/Models/SearchModel.cs b/CC98.Software/src/CC98.Software/Data/SearchModel.cs similarity index 89% rename from CC98.Software/src/CC98.Software/Models/SearchModel.cs rename to CC98.Software/src/CC98.Software/Data/SearchModel.cs index 4f92113..f463bcf 100644 --- a/CC98.Software/src/CC98.Software/Models/SearchModel.cs +++ b/CC98.Software/src/CC98.Software/Data/SearchModel.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using System.ComponentModel.DataAnnotations; -namespace CC98.Software.Models +namespace CC98.Software.Data { public class SearchModel { diff --git a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml index bed6a21..bffe864 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml @@ -1,105 +1,155 @@ -@using CC98.Software.Models -@model SearchModel +@using Microsoft.Extensions.Options + +@inject IOptions Setting + +@model Category[] + @{ + ViewData["Title"] = "首页-CC98软件站"; + } +
    +
    +

    软件推荐

    +
    +
    +

    软件分类

    +
    -
    视频软件
    -
    播放器  格式转换
    -
    聊天工具
    -
    浏览器
    -
    音乐软件
    -
    安全杀毒
    -
    系统工具
    -
    备份还原  硬件工具
    -
    桌面工具  数据恢复
    -
    系统优化  驱动工具
    -
    下载工具
    -
    办公软件
    -
    文档处理  办公常用
    -
    图像图片
    -
    编程工具
    -
    开发平台  运行库
    -
    辅助工具
    -
    行业软件
    -
    学习工具
    + + @foreach (Category i in Model) + + { + + if (i.Parent == null) + + { + +
    @i.Name
    + + } + + else + + { + +
    + + @foreach (Category p in i.Children) + + { + + @p.Name + + } + +
    + + } + + } +
    +
    +
    +

    常用软件集合

    -
    -
    安全上网
    -
    测试ING    测试ING    测试ING    测试ING    测试ING
    -
    测试ING    测试ING    测试ING    测试ING    测试ING
    -
    测试ING    测试ING    测试ING    测试ING    测试ING
    -
    安全上98
    -
    测试ING    测试ING    测试ING    测试ING    测试ING
    -
    测试ING    测试ING    测试ING    测试ING    测试ING
    -
    测试ING    测试ING    测试ING    测试ING    测试ING
    -
    安全下载
    -
    测试ING    测试ING    测试ING    测试ING    测试ING
    -
    测试ING    测试ING    测试ING    测试ING    测试ING
    -
    测试ING    测试ING    测试ING    测试ING    测试ING
    -
    快乐上网
    -
    测试ING    测试ING    测试ING    测试ING    测试ING
    -
    测试ING    测试ING    测试ING    测试ING    测试ING
    -
    测试ING    测试ING    测试ING    测试ING    测试ING
    -
    就要玩游戏
    -
    测试ING    测试ING    测试ING    测试ING    测试ING
    -
    测试ING    测试ING    测试ING    测试ING    测试ING
    - - -
    + + + + + + //这里是引用了两个分页 +
    - + + +
    -
    - - - - -
    + + + +
    +

    用户专区

    +
    -

    -              + +

    + +       我要上传       求未收录软件 +
    +

    +
    -              + +       我要反馈       +
    +

    +
    -             ck="" /> + +       FTP上传工具       +
    +

    +

    +
    +
    +
    +
    -

    常玩游戏下载

    - hhh -
    + +

    常玩游戏下载

    + + hhh + +
\ No newline at end of file diff --git a/CC98.Software/src/CC98.Software/Views/Shared/Components/Search/default.cshtml b/CC98.Software/src/CC98.Software/Views/Shared/Components/Search/default.cshtml index 5cbae2a..b206578 100644 --- a/CC98.Software/src/CC98.Software/Views/Shared/Components/Search/default.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Shared/Components/Search/default.cshtml @@ -1,7 +1,15 @@ - +@model SearchModel
+
- - + +
+ + + + + + +
-
\ No newline at end of file +
From 798b330f13648bd6ae536ec69fe9c5fb541ac50b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E7=8F=BA=20=E7=94=B0?= Date: Fri, 7 Apr 2017 19:51:23 +0800 Subject: [PATCH 21/38] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/HomeController.cs | 422 ++++++++++++++++-- 1 file changed, 391 insertions(+), 31 deletions(-) diff --git a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs index 2fc4bea..94985e9 100644 --- a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs +++ b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs @@ -1,85 +1,445 @@ using System; + using System.Collections.Generic; + using System.Linq; + using System.Threading.Tasks; + using CC98.Software.Data; + using Microsoft.AspNetCore.Http; + using Microsoft.AspNetCore.Mvc; -using CC98.Software.Models; + +using Microsoft.AspNetCore.Authorization; + +using Microsoft.Extensions.Options; + + namespace CC98.Software.Controllers + { + public class HomeController : Controller + { - public IActionResult Index() - { - return View(); - } - public IActionResult desktop() + public int amount; + + public IActionResult Index([FromServices] SoftwareDbContext q) + { - ViewData["Message"] = "Your application description page."; - return View(); + Data.Category[] m; + + var result = from i in q.Categories select i; + + m = result.ToArray(); + + return View(m); + } - - public IActionResult Upload(UploadWare m,[FromServices]SoftwareDbContext q) + + + + public IActionResult Upload(UploadWare m, [FromServices] SoftwareDbContext q) + { - System.IO.FileStream a=System.IO.File.OpenWrite(System.IO.Path.Combine("File", m.File.FileName)) ; + + 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, + 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, + + 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(); + + + q.Softwares.Add(newfile); + + q.SaveChanges(true); + + return View("AfterUploading"); + } - public IActionResult game() + public IActionResult ShowUpload() + { - ViewData["Message"] = "Your contact page."; return View(); + } + + + + + + public IActionResult Error() + { + return View(); + } - public IActionResult android() + + + + + public IActionResult Background([FromServices] SoftwareDbContext q) + { - return View(); + + Data.Software[] m; + + var result = from i in q.Softwares select i; + + m = result.ToArray(); + + return View(m); + } - public IActionResult apple() + + + public IActionResult UnAccepted(int id, [FromServices] SoftwareDbContext q) + { - return View(); + + Data.Software m; + + m = q.Softwares.Find(id); + + if (m == null) + + { + + return NotFound(); + + } + + else + + { + + q.Softwares.Remove(m); + + } + + q.SaveChanges(true); + + return RedirectToAction("houtai"); + } - public IActionResult houtai() + + + public IActionResult Accepted(int id, [FromServices] SoftwareDbContext q) + { - return View(); + + Data.Software m; + + m = q.Softwares.Find(id); + + if (m == null) + + { + + return NotFound(); + + } + + else + + { + + m.IsAccepted = true; + + } + + q.SaveChanges(true); + + return RedirectToAction("Background"); + } - public IActionResult Search([FromServices]SoftwareDbContext dbcontext,SearchModel model) + + + public IActionResult NewCategory(string name, [FromServices] SoftwareDbContext q) + + { + + Data.Category m = new Category(); + + m.Name = name; + + return RedirectToAction("Background"); + + } + + + + public IActionResult Delete(int id, [FromServices] SoftwareDbContext q) + + { + + Category m; + + m = q.Categories.Find(id); + + if (m == null) + + { + + return NotFound(); + + } + + else + + { + + q.Categories.Remove(m); + + } + + q.SaveChanges(true); + + return RedirectToAction("CategoryManagement"); + + } + + + + public IActionResult CategoryManagement([FromServices] SoftwareDbContext q) + + { + + Category[] m; + + var result = from i in q.Categories select i; + + m = result.ToArray(); + + return View(m); ; + + } + + + + public IActionResult New2Category(string name, int id, [FromServices] SoftwareDbContext q) + + { + + Data.Category m = new Category(); + + Data.Category n; + + n = q.Categories.Find(id); + + m.Name = name; + + m.Parent = n; + + q.SaveChanges(true); + + return RedirectToAction("Background"); + + } + + + + [Authorize] + + public IActionResult SendMessage(SMessage p, [FromServices] SoftwareDbContext q) + + { + + + + + + Data.Feedback newmes = new Data.Feedback + + { + + Message = p.Content, + + ReceiverName = p.Receivername, + + Time = DateTimeOffset.Now, + + Title = p.Title, + + SenderName = User.Identity.Name, + + }; + + q.Feedbacks.Add(newmes); + + q.SaveChanges(true); + + return RedirectToAction("Messagebox"); + + } + + public IActionResult Messagebox([FromServices] SoftwareDbContext q) + + { + + Data.Feedback[] m; + + string name = User.Identity.Name; + + var result = from i in q.Feedbacks where (i.ReceiverName == name || i.SenderName == name) select i; + + m = result.ToArray(); + + q.SaveChanges(true); + + return View(m); + + } + + public IActionResult MessageDetail(int id, [FromServices] SoftwareDbContext q) + + { + + Data.Feedback m = q.Feedbacks.Find(id); + + return View(m); + + } + + public IActionResult Details(int id, [FromServices] SoftwareDbContext q) + + { + + Data.Software m = q.Softwares.Find(id); + + return View(m); + + } + + public IActionResult List(int classid, int page, [FromServices] SoftwareDbContext q) + + { + + page++; + + Data.Software[] a; + + var b = from i in q.Softwares where i.Class.Id == 1 select i; + + ViewBag.amount = b.Count(); + + var c = b.Skip(10 * (page - 1)).Take(10); + + a = c.ToArray(); + + ViewBag.curPage = page; + + ViewBag.classid = classid; + + return View(a); + + + + } + + public IActionResult changeFrequencyT(int id, [FromServices]Data.SoftwareDbContext q) + + { + + Data.Software p = q.Softwares.Find(id); + + p.IsFrequent = true; + + q.SaveChanges(true); + + return RedirectToAction("Details"); + + } + + public IActionResult changeFrequencyF(int id, [FromServices]Data.SoftwareDbContext q) + + { + + Data.Software p = q.Softwares.Find(id); + + p.IsFrequent = false; + + q.SaveChanges(true); + + return RedirectToAction("Details"); + + } + + public IActionResult changeRecommendationT(int id, [FromServices]Data.SoftwareDbContext q) + + { + + Data.Software p = q.Softwares.Find(id); + + p.isRecommended = true; + + q.SaveChanges(true); + + return RedirectToAction("Details"); + + } + + public IActionResult changeRecommendationF(int id, [FromServices]Data.SoftwareDbContext q) + + { + + Data.Software p = q.Softwares.Find(id); + + p.isRecommended = false; + + q.SaveChanges(true); + + return RedirectToAction("Details"); + + } + + public IActionResult Search([FromServices]SoftwareDbContext dbcontext, SearchModel model) { var x = from i in dbcontext.Softwares where i.Name.Contains(model.Content) select i; - return View(x.ToArray()); + return RedirectToAction("List",x.ToArray()); } + } -} + +} \ No newline at end of file From ba8797573af0056fd9acfe30eac7af3273a2302a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E7=8F=BA=20=E7=94=B0?= Date: Mon, 10 Apr 2017 16:04:13 +0800 Subject: [PATCH 22/38] =?UTF-8?q?partial=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/CC98.Software/CC98.Software.csproj | 2 + .../Controllers/HomeController.cs | 242 +----------------- .../src/CC98.Software/Views/Home/List.cshtml | 16 +- .../CC98.Software/Views/Home/Search.cshtml | 15 +- .../CC98.Software/Views/Home/inList.cshtml | 3 + 5 files changed, 22 insertions(+), 256 deletions(-) create mode 100644 CC98.Software/src/CC98.Software/Views/Home/inList.cshtml diff --git a/CC98.Software/src/CC98.Software/CC98.Software.csproj b/CC98.Software/src/CC98.Software/CC98.Software.csproj index 02bc64e..f53477f 100644 --- a/CC98.Software/src/CC98.Software/CC98.Software.csproj +++ b/CC98.Software/src/CC98.Software/CC98.Software.csproj @@ -19,6 +19,7 @@ + @@ -37,6 +38,7 @@ + diff --git a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs index 94985e9..76076a6 100644 --- a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs +++ b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs @@ -1,445 +1,225 @@ using System; - using System.Collections.Generic; - using System.Linq; - using System.Threading.Tasks; - using CC98.Software.Data; - using Microsoft.AspNetCore.Http; - using Microsoft.AspNetCore.Mvc; - using Microsoft.AspNetCore.Authorization; - using Microsoft.Extensions.Options; - - namespace CC98.Software.Controllers - { - public class HomeController : Controller - { - public int amount; - public IActionResult Index([FromServices] SoftwareDbContext q) - { - Data.Category[] m; - var result = from i in q.Categories select i; - m = result.ToArray(); - return View(m); - } - - 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, - Platform = m.Platform, - 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); - q.SaveChanges(true); - return View("AfterUploading"); - } - public IActionResult ShowUpload() - { - return View(); - } - - - - public IActionResult Error() - { - return View(); - } - - - public IActionResult Background([FromServices] SoftwareDbContext q) - { - Data.Software[] m; - var result = from i in q.Softwares select i; - m = result.ToArray(); - return View(m); - } - - public IActionResult UnAccepted(int id, [FromServices] SoftwareDbContext q) - { - Data.Software m; - m = q.Softwares.Find(id); - if (m == null) - { - return NotFound(); - } - else - { - q.Softwares.Remove(m); - } - q.SaveChanges(true); - return RedirectToAction("houtai"); - } - - public IActionResult Accepted(int id, [FromServices] SoftwareDbContext q) - { - Data.Software m; - m = q.Softwares.Find(id); - if (m == null) - { - return NotFound(); - } - else - { - m.IsAccepted = true; - } - q.SaveChanges(true); - return RedirectToAction("Background"); - } - - public IActionResult NewCategory(string name, [FromServices] SoftwareDbContext q) - { - Data.Category m = new Category(); - m.Name = name; - return RedirectToAction("Background"); - } - - public IActionResult Delete(int id, [FromServices] SoftwareDbContext q) - { - Category m; - m = q.Categories.Find(id); - if (m == null) - { - return NotFound(); - } - else - { - q.Categories.Remove(m); - } - q.SaveChanges(true); - return RedirectToAction("CategoryManagement"); - } - - public IActionResult CategoryManagement([FromServices] SoftwareDbContext q) - { - Category[] m; - var result = from i in q.Categories select i; - m = result.ToArray(); - return View(m); ; - } - - public IActionResult New2Category(string name, int id, [FromServices] SoftwareDbContext q) - { - Data.Category m = new Category(); - Data.Category n; - n = q.Categories.Find(id); - m.Name = name; - m.Parent = n; - q.SaveChanges(true); - return RedirectToAction("Background"); - } - - [Authorize] - public IActionResult SendMessage(SMessage p, [FromServices] SoftwareDbContext q) - { - - - Data.Feedback newmes = new Data.Feedback - { - Message = p.Content, - ReceiverName = p.Receivername, - Time = DateTimeOffset.Now, - Title = p.Title, - SenderName = User.Identity.Name, - }; - q.Feedbacks.Add(newmes); - q.SaveChanges(true); - return RedirectToAction("Messagebox"); - } - public IActionResult Messagebox([FromServices] SoftwareDbContext q) - { - Data.Feedback[] m; - string name = User.Identity.Name; - var result = from i in q.Feedbacks where (i.ReceiverName == name || i.SenderName == name) select i; - m = result.ToArray(); - q.SaveChanges(true); - return View(m); - } - public IActionResult MessageDetail(int id, [FromServices] SoftwareDbContext q) - { - Data.Feedback m = q.Feedbacks.Find(id); - return View(m); - } - public IActionResult Details(int id, [FromServices] SoftwareDbContext q) - { - Data.Software m = q.Softwares.Find(id); - return View(m); - } - - public IActionResult List(int classid, int page, [FromServices] SoftwareDbContext q) - + public IActionResult InList(int page, int classid, [FromServices] SoftwareDbContext q) { - page++; - - Data.Software[] a; - - var b = from i in q.Softwares where i.Class.Id == 1 select i; - - ViewBag.amount = b.Count(); - - var c = b.Skip(10 * (page - 1)).Take(10); - - a = c.ToArray(); - - ViewBag.curPage = page; - - ViewBag.classid = classid; - - return View(a); - - - - } - + ViewBag.curPage = page; + var b = from i in q.Softwares where i.Class.Id == classid select i; + var c = b.ToArray(); + ViewBag.amount = c.Count(); + var m = c.Skip(10 * (page - 1)).Take(10); + return View(m.ToArray()); + } + public IActionResult changeFrequencyT(int id, [FromServices]Data.SoftwareDbContext q) - { - Data.Software p = q.Softwares.Find(id); - p.IsFrequent = true; - q.SaveChanges(true); - return RedirectToAction("Details"); - } - public IActionResult changeFrequencyF(int id, [FromServices]Data.SoftwareDbContext q) - { - Data.Software p = q.Softwares.Find(id); - p.IsFrequent = false; - q.SaveChanges(true); - return RedirectToAction("Details"); - } - public IActionResult changeRecommendationT(int id, [FromServices]Data.SoftwareDbContext q) - { - Data.Software p = q.Softwares.Find(id); - p.isRecommended = true; - q.SaveChanges(true); - return RedirectToAction("Details"); - } - public IActionResult changeRecommendationF(int id, [FromServices]Data.SoftwareDbContext q) - { - Data.Software p = q.Softwares.Find(id); - p.isRecommended = false; - q.SaveChanges(true); - return RedirectToAction("Details"); - } - public IActionResult Search([FromServices]SoftwareDbContext dbcontext, SearchModel model) { var x = from i in dbcontext.Softwares where i.Name.Contains(model.Content) select i; - return RedirectToAction("List",x.ToArray()); + return View(x.ToArray()); } } - -} \ No newline at end of file +} diff --git a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml index d29eddc..4af194b 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml @@ -6,17 +6,7 @@
-
-
-
-
- - -
- - -
-
+

@@ -58,11 +48,11 @@
- @for(int page = 1; page <= ViewBag.amount/10+1; page++) { + @for(int page = 1; page <=ViewBag.amount/10+1; page++) { @page } - 下一页 + 下一页
diff --git a/CC98.Software/src/CC98.Software/Views/Home/Search.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Search.cshtml index dcf314d..d8a16bd 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Search.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Search.cshtml @@ -1,12 +1,3 @@ -@* - For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 -*@ -@using CC98.Software.Models -@model Software[] -@{ - ViewData["Title"] = "SearchResult"; -} -@foreach(Software i in Model) -{ - @i.Name -} +@model Software[] + +@Html.Partial("List", Model); diff --git a/CC98.Software/src/CC98.Software/Views/Home/inList.cshtml b/CC98.Software/src/CC98.Software/Views/Home/inList.cshtml new file mode 100644 index 0000000..d8a16bd --- /dev/null +++ b/CC98.Software/src/CC98.Software/Views/Home/inList.cshtml @@ -0,0 +1,3 @@ +@model Software[] + +@Html.Partial("List", Model); From 7d110a8cc77f685635d893257b30fe63dfc5567f Mon Sep 17 00:00:00 2001 From: MoLan1980 <775026348@qq.com> Date: Mon, 17 Apr 2017 22:55:03 +0800 Subject: [PATCH 23/38] =?UTF-8?q?=E4=B8=BB=E9=A1=B5=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E5=93=8D=E5=BA=94=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/CC98.Software/Views/Home/Index.cshtml | 148 +++++++++--------- 1 file changed, 73 insertions(+), 75 deletions(-) diff --git a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml index bffe864..3536970 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml @@ -6,150 +6,148 @@ @{ - ViewData["Title"] = "首页-CC98软件站"; + ViewData["Title"] = "首页-CC98软件站"; } +
-
+
-
+
-

软件推荐

+

软件推荐

-
+
+
-
-

软件分类

+ @*调试1*@ +
-
+

软件分类

- @foreach (Category i in Model) +
- { + @foreach (Category i in Model) - if (i.Parent == null) + { - { + if (i.Parent == null) -
@i.Name
+ { - } +
@i.Name
- else + } - { + else -
+ { - @foreach (Category p in i.Children) +
- { + @foreach (Category p in i.Children) - @p.Name + { - } + @p.Name -
+ } - } + - } + } -
+ } -
+ -
+
-

常用软件集合

- +
+
+

常用软件集合

- + - //这里是引用了两个分页 + -
+ @*这里是引用了两个分页*@ +
+
-
+
- + - -
+
-

用户专区

+

用户专区

- -

+

-
+
+ 我要反馈 FTP上传工具 -       我要反馈       +
-
+

-

-
-       FTP上传工具       -
+
-

+
-

+
+
+
-
+

常玩游戏下载

-
+ hhh +
- -
- -

常玩游戏下载

- - hhh - -
\ No newline at end of file From 78df4b6f57cb84e9eb26a3c09adb10b1fe2eaef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?y=E6=96=B9=E7=AD=89=E4=BA=8E4x?= Date: Fri, 21 Apr 2017 19:19:10 +0800 Subject: [PATCH 24/38] =?UTF-8?q?4.21=20=E5=B9=B6=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E4=BB=80=E4=B9=88=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CC98.Software/src/CC98.Software/Views/Home/List.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml index d29eddc..dc87d14 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml @@ -13,7 +13,7 @@
- +
From c40cac96f8ebdbeea452e0da250607b9a740e51d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?y=E6=96=B9=E7=AD=89=E4=BA=8E4x?= Date: Fri, 21 Apr 2017 21:22:38 +0800 Subject: [PATCH 25/38] =?UTF-8?q?list=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/CC98.Software/SearchViewComponent.cs | 22 --- .../src/CC98.Software/Views/Home/Index.cshtml | 7 +- .../src/CC98.Software/Views/Home/List.cshtml | 125 +++++++++++------- .../HotSoftwares}/ShowUpload.cshtml | 0 4 files changed, 83 insertions(+), 71 deletions(-) delete mode 100644 CC98.Software/src/CC98.Software/SearchViewComponent.cs rename CC98.Software/src/CC98.Software/Views/{Home => Shared/Components/HotSoftwares}/ShowUpload.cshtml (100%) diff --git a/CC98.Software/src/CC98.Software/SearchViewComponent.cs b/CC98.Software/src/CC98.Software/SearchViewComponent.cs deleted file mode 100644 index 41c1d39..0000000 --- a/CC98.Software/src/CC98.Software/SearchViewComponent.cs +++ /dev/null @@ -1,22 +0,0 @@ -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 SearchViewComponent : Microsoft.AspNetCore.Mvc.ViewComponent - { - public IViewComponentResult Invoke([FromServices] Data.SoftwareDbContext q, Data.SearchModel model) - { - var x = from i in q.Softwares - - where i.Name.Contains(model.Content) - - select i; - - return View(x.ToArray()); - } - } -} diff --git a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml index 3536970..ae54fff 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml @@ -9,14 +9,15 @@ ViewData["Title"] = "首页-CC98软件站"; } +
- -

软件推荐

- + +

软件推荐

+
diff --git a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml index dc87d14..0d570bc 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml @@ -1,81 +1,114 @@ -@model Software[] +@model Software[]

-
+
+
+ 图片 +
-
-
-
- - -
- - -
+
- +
+

+
+
@foreach (Software i in Model) { -
- -
-
-
...
-
- @i.Introduction -

@i.DownloadNum 评论数

-
-
- } - - -
-

+
-

-
-
- 热门应用 -
应用 -
应用 +
+ ... +
+
+
+ @i.Introduction + 这里是内容 哈哈哈哈哈哈哈哈哈哈哈哈哈哈asda哈哈哈哈sada a dsa asd as da 哈哈asdssssss asdasdas dasd哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈 +
+
+

下载数:@i.DownloadNum  评论数:i.Comments.Count  时间:@i.UpdateTime  上传者:@i.Uploadername

+
+
-
- - +
+ }
-
+
- @for(int page = 1; page <= ViewBag.amount/10+1; page++) { - - @page - } - 下一页 + @for (int page = 1; page <= ViewBag.amount / 10 + 1; page++) + { + @page + } + 下一页
-
- 1  - n +
+ 1  + n
-
+
+

+
热门应用
+
1
+
+
+ + +
+ +
+
+
+
+
+
+
+

用户专区

+ +
+
+

我要上传

+ +
+
+

我要反馈

+ +
+
+

FTP上传工具

+ +
+
+
+
+
+
diff --git a/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml b/CC98.Software/src/CC98.Software/Views/Shared/Components/HotSoftwares/ShowUpload.cshtml similarity index 100% rename from CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml rename to CC98.Software/src/CC98.Software/Views/Shared/Components/HotSoftwares/ShowUpload.cshtml From b57a3baa5daca6dbf90923b75ab5bec5e8e939e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E7=8F=BA=20=E7=94=B0?= Date: Fri, 21 Apr 2017 22:10:06 +0800 Subject: [PATCH 26/38] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=BA=AB=E4=BB=BD?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=20=20=E5=90=8C=E6=AD=A5=E6=94=B9=E5=BC=82?= =?UTF-8?q?=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/CC98.Software/CC98.Software.csproj | 4 + .../Controllers/HomeController.cs | 113 +++++++------ .../src/CC98.Software/Data/Software.cs | 4 +- .../Migrations/20170421111911_421.Designer.cs | 148 +++++++++++++++++ .../Migrations/20170421111911_421.cs | 65 ++++++++ .../20170421112118_4211.Designer.cs | 148 +++++++++++++++++ .../Migrations/20170421112118_4211.cs | 19 +++ .../20170421112509_4212.Designer.cs | 148 +++++++++++++++++ .../Migrations/20170421112509_4212.cs | 35 ++++ .../SoftwareDbContextModelSnapshot.cs | 22 +-- .../src/CC98.Software/SearchViewComponent.cs | 22 --- CC98.Software/src/CC98.Software/Startup.cs | 11 +- ...erUploading.html => AfterUploading.cshtml} | 0 .../Views/Home/Background.cshtml | 2 +- .../Views/Home/CategoryManagement.cshtml | 10 +- .../CC98.Software/Views/Home/Details.cshtml | 11 +- .../src/CC98.Software/Views/Home/Index.cshtml | 150 +++++++++--------- .../Shared/Components/Search/default.cshtml | 15 -- .../CC98.Software/Views/Shared/Layout.cshtml | 68 -------- .../CC98.Software/Views/Shared/_Layout.cshtml | 22 ++- 20 files changed, 747 insertions(+), 270 deletions(-) create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170421111911_421.Designer.cs create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170421111911_421.cs create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170421112118_4211.Designer.cs create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170421112118_4211.cs create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170421112509_4212.Designer.cs create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170421112509_4212.cs delete mode 100644 CC98.Software/src/CC98.Software/SearchViewComponent.cs rename CC98.Software/src/CC98.Software/Views/Home/{AfterUploading.html => AfterUploading.cshtml} (100%) delete mode 100644 CC98.Software/src/CC98.Software/Views/Shared/Components/Search/default.cshtml delete mode 100644 CC98.Software/src/CC98.Software/Views/Shared/Layout.cshtml diff --git a/CC98.Software/src/CC98.Software/CC98.Software.csproj b/CC98.Software/src/CC98.Software/CC98.Software.csproj index f53477f..8f5bee4 100644 --- a/CC98.Software/src/CC98.Software/CC98.Software.csproj +++ b/CC98.Software/src/CC98.Software/CC98.Software.csproj @@ -51,4 +51,8 @@ + + + + diff --git a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs index 76076a6..f2a574f 100644 --- a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs +++ b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs @@ -7,26 +7,27 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Authorization; using Microsoft.Extensions.Options; +using Microsoft.EntityFrameworkCore; namespace CC98.Software.Controllers { public class HomeController : Controller { public int amount; - public IActionResult Index([FromServices] SoftwareDbContext q) + public async Task Index([FromServices] SoftwareDbContext q) { Data.Category[] m; var result = from i in q.Categories select i; - m = result.ToArray(); + m = await result.ToArrayAsync(); return View(m); } - public IActionResult Upload(UploadWare m, [FromServices] SoftwareDbContext q) + public async Task 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); + await m.File.CopyToAsync(a); System.IO.FileStream b = System.IO.File.OpenWrite(System.IO.Path.Combine("File", m.File.FileName)); - m.Photo.CopyTo(b); + await m.Photo.CopyToAsync(b); //新开空文件 返回文件流 将IFormFile格式文件转为FileStream存入本地服务器 Data.Software newfile = new Data.Software { @@ -40,7 +41,7 @@ public IActionResult Upload(UploadWare m, [FromServices] SoftwareDbContext q) }; q.Softwares.Add(newfile); - q.SaveChanges(true); + await q.SaveChangesAsync(true); return View("AfterUploading"); } public IActionResult ShowUpload() @@ -55,16 +56,16 @@ public IActionResult Error() return View(); } - - public IActionResult Background([FromServices] SoftwareDbContext q) + [Authorize("Manage")] + public async Task Background([FromServices] SoftwareDbContext q) { Data.Software[] m; var result = from i in q.Softwares select i; - m = result.ToArray(); + m = await result.ToArrayAsync(); return View(m); } - public IActionResult UnAccepted(int id, [FromServices] SoftwareDbContext q) + public async Task UnAccepted(int id, [FromServices] SoftwareDbContext q) { Data.Software m; m = q.Softwares.Find(id); @@ -76,11 +77,11 @@ public IActionResult UnAccepted(int id, [FromServices] SoftwareDbContext q) { q.Softwares.Remove(m); } - q.SaveChanges(true); - return RedirectToAction("houtai"); + await q.SaveChangesAsync(true); + return RedirectToAction("Background"); } - public IActionResult Accepted(int id, [FromServices] SoftwareDbContext q) + public async Task Accepted(int id, [FromServices] SoftwareDbContext q) { Data.Software m; m = q.Softwares.Find(id); @@ -92,21 +93,23 @@ public IActionResult Accepted(int id, [FromServices] SoftwareDbContext q) { m.IsAccepted = true; } - q.SaveChanges(true); + await q.SaveChangesAsync(true); return RedirectToAction("Background"); } - public IActionResult NewCategory(string name, [FromServices] SoftwareDbContext q) + public async Task NewCategory(string name, [FromServices] SoftwareDbContext q) { Data.Category m = new Category(); m.Name = name; - return RedirectToAction("Background"); + q.Categories.Add(m); + await q.SaveChangesAsync(true); + return RedirectToAction("CategoryManagement"); } - public IActionResult Delete(int id, [FromServices] SoftwareDbContext q) + public async Task Delete(int id, [FromServices] SoftwareDbContext q) { Category m; - m = q.Categories.Find(id); + m =await q.Categories.FindAsync(id); if (m == null) { return NotFound(); @@ -115,31 +118,31 @@ public IActionResult Delete(int id, [FromServices] SoftwareDbContext q) { q.Categories.Remove(m); } - q.SaveChanges(true); + await q.SaveChangesAsync(true); return RedirectToAction("CategoryManagement"); } - public IActionResult CategoryManagement([FromServices] SoftwareDbContext q) + public async Task CategoryManagement([FromServices] SoftwareDbContext q) { Category[] m; var result = from i in q.Categories select i; - m = result.ToArray(); + m = await result.ToArrayAsync(); return View(m); ; } - public IActionResult New2Category(string name, int id, [FromServices] SoftwareDbContext q) + public async Task New2Category(string name, int id, [FromServices] SoftwareDbContext q) { Data.Category m = new Category(); Data.Category n; - n = q.Categories.Find(id); + n = await q.Categories.FindAsync(id); m.Name = name; m.Parent = n; - q.SaveChanges(true); - return RedirectToAction("Background"); + await q.SaveChangesAsync(true); + return RedirectToAction("CategoryManagement"); } [Authorize] - public IActionResult SendMessage(SMessage p, [FromServices] SoftwareDbContext q) + public async Task SendMessage(SMessage p, [FromServices] SoftwareDbContext q) { @@ -152,74 +155,80 @@ public IActionResult SendMessage(SMessage p, [FromServices] SoftwareDbContext q) SenderName = User.Identity.Name, }; q.Feedbacks.Add(newmes); - q.SaveChanges(true); + await q.SaveChangesAsync(true); return RedirectToAction("Messagebox"); } - public IActionResult Messagebox([FromServices] SoftwareDbContext q) + public async Task Messagebox([FromServices] SoftwareDbContext q) { Data.Feedback[] m; string name = User.Identity.Name; var result = from i in q.Feedbacks where (i.ReceiverName == name || i.SenderName == name) select i; - m = result.ToArray(); - q.SaveChanges(true); + m = await result.ToArrayAsync(); + await q.SaveChangesAsync(true); return View(m); } - public IActionResult MessageDetail(int id, [FromServices] SoftwareDbContext q) + public async Task MessageDetail(int id, [FromServices] SoftwareDbContext q) { - Data.Feedback m = q.Feedbacks.Find(id); + Data.Feedback m =await q.Feedbacks.FindAsync(id); return View(m); } - public IActionResult Details(int id, [FromServices] SoftwareDbContext q) + public async Task Details(int id, [FromServices] SoftwareDbContext q) { - Data.Software m = q.Softwares.Find(id); + Data.Software m = await q.Softwares.FindAsync(id); return View(m); } - public IActionResult InList(int page, int classid, [FromServices] SoftwareDbContext q) + public async Task InList(int page, int classid, [FromServices] SoftwareDbContext q) { page++; ViewBag.curPage = page; var b = from i in q.Softwares where i.Class.Id == classid select i; - var c = b.ToArray(); - ViewBag.amount = c.Count(); - var m = c.Skip(10 * (page - 1)).Take(10); - return View(m.ToArray()); + ViewBag.amount =await b.CountAsync(); + var m = b.Skip(10 * (page - 1)).Take(10); + return View(await m.ToArrayAsync()); } - public IActionResult changeFrequencyT(int id, [FromServices]Data.SoftwareDbContext q) + public async Task changeFrequencyT(int id, [FromServices]Data.SoftwareDbContext q) { Data.Software p = q.Softwares.Find(id); p.IsFrequent = true; - q.SaveChanges(true); + await q.SaveChangesAsync(true); return RedirectToAction("Details"); } - public IActionResult changeFrequencyF(int id, [FromServices]Data.SoftwareDbContext q) + public async Task changeFrequencyF(int id, [FromServices]Data.SoftwareDbContext q) { Data.Software p = q.Softwares.Find(id); p.IsFrequent = false; - q.SaveChanges(true); + await q.SaveChangesAsync(true); return RedirectToAction("Details"); } - public IActionResult changeRecommendationT(int id, [FromServices]Data.SoftwareDbContext q) + public async Task changeRecommendationT(int id, [FromServices]Data.SoftwareDbContext q) { Data.Software p = q.Softwares.Find(id); - p.isRecommended = true; - q.SaveChanges(true); + p.IsRecommended = true; + await q.SaveChangesAsync(true); return RedirectToAction("Details"); } - public IActionResult changeRecommendationF(int id, [FromServices]Data.SoftwareDbContext q) + public async Task changeRecommendationF(int id, [FromServices]Data.SoftwareDbContext q) { Data.Software p = q.Softwares.Find(id); - p.isRecommended = false; - q.SaveChanges(true); + p.IsRecommended = false; + await q.SaveChangesAsync(true); return RedirectToAction("Details"); } - public IActionResult Search([FromServices]SoftwareDbContext dbcontext, SearchModel model) + public async Task Search([FromServices]SoftwareDbContext dbcontext, string content) { var x = from i in dbcontext.Softwares - where i.Name.Contains(model.Content) + where i.Name.Contains(content) select i; - return View(x.ToArray()); + return View(await x.ToArrayAsync()); } + public async Task DeleteSoftware(int id,[FromServices]SoftwareDbContext q) + { + var x = q.Softwares.Find(id); + q.Softwares.Remove(x); + await q.SaveChangesAsync(); + return View("Index"); + } } } diff --git a/CC98.Software/src/CC98.Software/Data/Software.cs b/CC98.Software/src/CC98.Software/Data/Software.cs index 5864d4f..114618c 100644 --- a/CC98.Software/src/CC98.Software/Data/Software.cs +++ b/CC98.Software/src/CC98.Software/Data/Software.cs @@ -71,11 +71,11 @@ public string FileLocation { get; set; } - public string Uploadername + public string UploaderName { get; set; } - public bool isRecommended { get; set; } + public bool IsRecommended { get; set; } [InverseProperty("CommentBelongto")] diff --git a/CC98.Software/src/CC98.Software/Migrations/20170421111911_421.Designer.cs b/CC98.Software/src/CC98.Software/Migrations/20170421111911_421.Designer.cs new file mode 100644 index 0000000..28e9495 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Migrations/20170421111911_421.Designer.cs @@ -0,0 +1,148 @@ +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("20170421111911_421")] + partial class _421 + { + 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.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.Property("isRecommended"); + + 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/20170421111911_421.cs b/CC98.Software/src/CC98.Software/Migrations/20170421111911_421.cs new file mode 100644 index 0000000..90631b7 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Migrations/20170421111911_421.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Metadata; + +namespace CC98.Software.Migrations +{ + public partial class _421 : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "SMessages"); + + migrationBuilder.AddColumn( + name: "Uploadername", + table: "Softwares", + nullable: true); + + migrationBuilder.AddColumn( + name: "isRecommended", + table: "Softwares", + nullable: false, + defaultValue: false); + + migrationBuilder.AlterColumn( + name: "Commenttime", + table: "Comments", + nullable: false, + oldClrType: typeof(DateTime)); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Uploadername", + table: "Softwares"); + + migrationBuilder.DropColumn( + name: "isRecommended", + table: "Softwares"); + + migrationBuilder.AlterColumn( + name: "Commenttime", + table: "Comments", + nullable: false, + oldClrType: typeof(DateTimeOffset)); + + 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); + }); + } + } +} diff --git a/CC98.Software/src/CC98.Software/Migrations/20170421112118_4211.Designer.cs b/CC98.Software/src/CC98.Software/Migrations/20170421112118_4211.Designer.cs new file mode 100644 index 0000000..2253446 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Migrations/20170421112118_4211.Designer.cs @@ -0,0 +1,148 @@ +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("20170421112118_4211")] + partial class _4211 + { + 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.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.Property("isRecommended"); + + 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/20170421112118_4211.cs b/CC98.Software/src/CC98.Software/Migrations/20170421112118_4211.cs new file mode 100644 index 0000000..ff8ce3e --- /dev/null +++ b/CC98.Software/src/CC98.Software/Migrations/20170421112118_4211.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace CC98.Software.Migrations +{ + public partial class _4211 : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/CC98.Software/src/CC98.Software/Migrations/20170421112509_4212.Designer.cs b/CC98.Software/src/CC98.Software/Migrations/20170421112509_4212.Designer.cs new file mode 100644 index 0000000..f7d12b1 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Migrations/20170421112509_4212.Designer.cs @@ -0,0 +1,148 @@ +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("20170421112509_4212")] + partial class _4212 + { + 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.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("IsRecommended"); + + 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/20170421112509_4212.cs b/CC98.Software/src/CC98.Software/Migrations/20170421112509_4212.cs new file mode 100644 index 0000000..736ee2f --- /dev/null +++ b/CC98.Software/src/CC98.Software/Migrations/20170421112509_4212.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace CC98.Software.Migrations +{ + public partial class _4212 : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "isRecommended", + table: "Softwares", + newName: "IsRecommended"); + + migrationBuilder.RenameColumn( + name: "Uploadername", + table: "Softwares", + newName: "UploaderName"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "UploaderName", + table: "Softwares", + newName: "Uploadername"); + + migrationBuilder.RenameColumn( + name: "IsRecommended", + table: "Softwares", + newName: "isRecommended"); + } + } +} diff --git a/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs b/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs index 28dfad9..083e335 100644 --- a/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs +++ b/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs @@ -39,7 +39,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("CommentBelongtoId"); - b.Property("Commenttime"); + b.Property("Commenttime"); b.Property("Contents"); @@ -84,22 +84,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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") @@ -117,6 +101,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("IsFrequent"); + b.Property("IsRecommended"); + b.Property("Name"); b.Property("PhotoLocation"); @@ -127,6 +113,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("UpdateTime"); + b.Property("UploaderName"); + b.HasKey("Id"); b.HasIndex("ClassId"); diff --git a/CC98.Software/src/CC98.Software/SearchViewComponent.cs b/CC98.Software/src/CC98.Software/SearchViewComponent.cs deleted file mode 100644 index 41c1d39..0000000 --- a/CC98.Software/src/CC98.Software/SearchViewComponent.cs +++ /dev/null @@ -1,22 +0,0 @@ -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 SearchViewComponent : Microsoft.AspNetCore.Mvc.ViewComponent - { - public IViewComponentResult Invoke([FromServices] Data.SoftwareDbContext q, Data.SearchModel model) - { - var x = from i in q.Softwares - - where i.Name.Contains(model.Content) - - select i; - - return View(x.ToArray()); - } - } -} diff --git a/CC98.Software/src/CC98.Software/Startup.cs b/CC98.Software/src/CC98.Software/Startup.cs index 214124e..5a44a73 100644 --- a/CC98.Software/src/CC98.Software/Startup.cs +++ b/CC98.Software/src/CC98.Software/Startup.cs @@ -89,6 +89,7 @@ public void ConfigureServices(IServiceCollection services) identityOptions.Cookies.ApplicationCookie.CookieSecure = CookieSecurePolicy.None; identityOptions.Cookies.ApplicationCookie.LoginPath = new PathString("/Account/LogOn"); identityOptions.Cookies.ApplicationCookie.LogoutPath = new PathString("/Account/LogOff"); + identityOptions.Cookies.ApplicationCookie.AccessDeniedPath = new PathString("/Account/AccessDenied"); identityOptions.Cookies.ApplicationCookie.AutomaticAuthenticate = true; identityOptions.Cookies.ApplicationCookie.AutomaticChallenge = true; @@ -99,6 +100,14 @@ public void ConfigureServices(IServiceCollection services) identityOptions.Cookies.ExternalCookie.AutomaticChallenge = false; }); + services.AddAuthorization(options => + { + options.AddPolicy("Manage", builder => + { + builder.RequireRole("Software Administrators", "Software Operators"); + }); + }); + } /// @@ -117,7 +126,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF loggerFactory.AddDebug(); if (env.IsDevelopment()) - { + { // 在开发环境中显示详细代码错误 app.UseDeveloperExceptionPage(); // 在开发环境中使用浏览器监视器 diff --git a/CC98.Software/src/CC98.Software/Views/Home/AfterUploading.html b/CC98.Software/src/CC98.Software/Views/Home/AfterUploading.cshtml similarity index 100% rename from CC98.Software/src/CC98.Software/Views/Home/AfterUploading.html rename to CC98.Software/src/CC98.Software/Views/Home/AfterUploading.cshtml diff --git a/CC98.Software/src/CC98.Software/Views/Home/Background.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Background.cshtml index ca980e1..15e6dd2 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Background.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Background.cshtml @@ -2,7 +2,7 @@

后台审核界面

- +分类管理
diff --git a/CC98.Software/src/CC98.Software/Views/Home/CategoryManagement.cshtml b/CC98.Software/src/CC98.Software/Views/Home/CategoryManagement.cshtml index 4345047..a449076 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/CategoryManagement.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/CategoryManagement.cshtml @@ -1,7 +1,7 @@ @model Category [] @{ -} +}
@@ -16,17 +16,17 @@ @i.Name; - + - + if (i.Parent == null) { foreach (Category p in i.Children) { - - + + } } diff --git a/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml index 647d85d..b28d5dd 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml @@ -1,4 +1,6 @@ -@model Software +@using Microsoft.AspNetCore.Authorization +@model Software +@inject IAuthorizationService Authorization
@@ -10,7 +12,10 @@

- +@if (await Authorization.AuthorizeAsync(User, "Manage")) +{ + +}
@Model.Name
@@ -43,7 +48,7 @@
时间
-
@Model.Uploadername
+
@Model.UploaderName
上传者
diff --git a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml index 3536970..147daaf 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml @@ -1,153 +1,147 @@ @using Microsoft.Extensions.Options - @inject IOptions Setting - @model Category[] - @{ - - ViewData["Title"] = "首页-CC98软件站"; - + ViewData["Title"] = "首页-CC98软件站"; }
-
- -
+
-

软件推荐

+
-
-
+

软件推荐

+
+
- @*调试1*@ -
-

软件分类

+ @*调试1*@ +
-
+

软件分类

- @foreach (Category i in Model) +
- { + @foreach (Category i in Model) - if (i.Parent == null) + { - { + if (i.Parent == null) -
@i.Name
+ { - } +
@i.Name
- else + } - { + else -
+ { - @foreach (Category p in i.Children) +
- { + @foreach (Category p in i.Children) - @p.Name + { - } + @p.Name + } -
+ - } + } - } + } -
+
-
+
-
-
-

常用软件集合

+
+
+

常用软件集合

- + - + - @*这里是引用了两个分页*@ -
-
+ @*这里是引用了两个分页*@ +
+
- -
-
-
+
+
+
-

常玩游戏下载

+

常玩游戏下载

- hhh + hhh -
+
diff --git a/CC98.Software/src/CC98.Software/Views/Shared/Components/Search/default.cshtml b/CC98.Software/src/CC98.Software/Views/Shared/Components/Search/default.cshtml deleted file mode 100644 index b206578..0000000 --- a/CC98.Software/src/CC98.Software/Views/Shared/Components/Search/default.cshtml +++ /dev/null @@ -1,15 +0,0 @@ -@model SearchModel -
- -
- - - - - - - - - -
-
diff --git a/CC98.Software/src/CC98.Software/Views/Shared/Layout.cshtml b/CC98.Software/src/CC98.Software/Views/Shared/Layout.cshtml deleted file mode 100644 index 7b96ac9..0000000 --- a/CC98.Software/src/CC98.Software/Views/Shared/Layout.cshtml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - @ViewData["Title"] - CC98.Software - - - - - - - - - - - - -
- @RenderBody() -
-
-

© 2016 - CC98.Software

-
-
- - - - - - - - - - - - - @RenderSection("scripts", required: false) - - diff --git a/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml b/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml index e7595ba..9a14bd9 100644 --- a/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml @@ -1,4 +1,6 @@ - +@using Microsoft.AspNetCore.Authorization +@inject IAuthorizationService Authorization + @@ -31,11 +33,19 @@ From 035348e9b4ee7a4da81c1683bb8ba9ac791a0ac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?y=E6=96=B9=E7=AD=89=E4=BA=8E4x?= Date: Fri, 28 Apr 2017 16:55:00 +0800 Subject: [PATCH 27/38] 4.28 --- CC98.Software/src/CC98.Software/Views/Home/List.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml index 0d570bc..9ca3cfb 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml @@ -36,7 +36,7 @@ 这里是内容 哈哈哈哈哈哈哈哈哈哈哈哈哈哈asda哈哈哈哈sada a dsa asd as da 哈哈asdssssss asdasdas dasd哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
-

下载数:@i.DownloadNum  评论数:i.Comments.Count  时间:@i.UpdateTime  上传者:@i.Uploadername

+

下载数:@i.DownloadNum  评论数:i.Comments.Count  时间:@i.UpdateTime  上传者:@i.UploaderName

From 30d0f44a693b3f1e6cf678ffb48abcac8b3c24e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E7=8F=BA=20=E7=94=B0?= Date: Fri, 28 Apr 2017 19:34:41 +0800 Subject: [PATCH 28/38] =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E9=87=8D=E5=86=99+=E6=B5=8B=E8=AF=95=20?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E9=9C=80=E8=A6=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/HomeController.cs | 17 +- .../src/CC98.Software/Data/Software.cs | 2 +- .../Migrations/20170428110117_428.Designer.cs | 148 +++++++++++++++++ .../Migrations/20170428110117_428.cs | 19 +++ .../20170428110754_4281.Designer.cs | 150 ++++++++++++++++++ .../Migrations/20170428110754_4281.cs | 24 +++ .../SoftwareDbContextModelSnapshot.cs | 2 + .../CC98.Software/Views/Home/Details.cshtml | 18 +-- .../src/CC98.Software/Views/Home/List.cshtml | 2 +- .../Views/Home/ShowUpload.cshtml | 2 +- 10 files changed, 361 insertions(+), 23 deletions(-) create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170428110117_428.Designer.cs create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170428110117_428.cs create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170428110754_4281.Designer.cs create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170428110754_4281.cs diff --git a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs index f2a574f..cedec98 100644 --- a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs +++ b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs @@ -24,20 +24,21 @@ public async Task Index([FromServices] SoftwareDbContext q) public async Task Upload(UploadWare m, [FromServices] SoftwareDbContext q) { - System.IO.FileStream a = System.IO.File.OpenWrite(System.IO.Path.Combine("File", m.File.FileName)); + System.IO.FileStream a = System.IO.File.OpenWrite(System.IO.Path.Combine("C:\\Test\\", m.Name)); await m.File.CopyToAsync(a); - System.IO.FileStream b = System.IO.File.OpenWrite(System.IO.Path.Combine("File", m.File.FileName)); + System.IO.FileStream b = System.IO.File.OpenWrite(System.IO.Path.Combine("C:\\Test\\Gra", m.Name)); await m.Photo.CopyToAsync(b); //新开空文件 返回文件流 将IFormFile格式文件转为FileStream存入本地服务器 Data.Software newfile = new Data.Software { - + Name=m.Name, Introduction = m.Introduction, Platform = m.Platform, - FileLocation = System.IO.Path.Combine("File", m.File.FileName), - PhotoLocation = System.IO.Path.Combine("File", m.Photo.FileName), + FileLocation = System.IO.Path.Combine("C:\\Test\\", m.Name), + PhotoLocation = System.IO.Path.Combine("C:\\Test\\Gra", m.Name), UpdateTime = DateTimeOffset.Now, DownloadNum = 0, + Filename=m.File.FileName, }; q.Softwares.Add(newfile); @@ -230,5 +231,11 @@ public async Task DeleteSoftware(int id,[FromServices]SoftwareDbC await q.SaveChangesAsync(); return View("Index"); } + + public IActionResult Download(int id,[FromServices]SoftwareDbContext q) + { + var x = q.Softwares.Find(id); + return PhysicalFile(x.FileLocation, "application/octet-stream",x.Filename); + } } } diff --git a/CC98.Software/src/CC98.Software/Data/Software.cs b/CC98.Software/src/CC98.Software/Data/Software.cs index 114618c..78f2148 100644 --- a/CC98.Software/src/CC98.Software/Data/Software.cs +++ b/CC98.Software/src/CC98.Software/Data/Software.cs @@ -76,7 +76,7 @@ public string UploaderName get; set; } public bool IsRecommended { get; set; } - + public string Filename { get; set; } [InverseProperty("CommentBelongto")] public virtual ICollection Comments { get; set; } = new Collection(); diff --git a/CC98.Software/src/CC98.Software/Migrations/20170428110117_428.Designer.cs b/CC98.Software/src/CC98.Software/Migrations/20170428110117_428.Designer.cs new file mode 100644 index 0000000..1c9cce8 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Migrations/20170428110117_428.Designer.cs @@ -0,0 +1,148 @@ +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("20170428110117_428")] + partial class _428 + { + 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.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("IsRecommended"); + + 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/20170428110117_428.cs b/CC98.Software/src/CC98.Software/Migrations/20170428110117_428.cs new file mode 100644 index 0000000..e387052 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Migrations/20170428110117_428.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace CC98.Software.Migrations +{ + public partial class _428 : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/CC98.Software/src/CC98.Software/Migrations/20170428110754_4281.Designer.cs b/CC98.Software/src/CC98.Software/Migrations/20170428110754_4281.Designer.cs new file mode 100644 index 0000000..bbf54f1 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Migrations/20170428110754_4281.Designer.cs @@ -0,0 +1,150 @@ +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("20170428110754_4281")] + partial class _4281 + { + 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.Software", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClassId"); + + b.Property("DownloadNum"); + + b.Property("FileLocation"); + + b.Property("Filename"); + + b.Property("Introduction"); + + b.Property("IsAccepted"); + + b.Property("IsFrequent"); + + b.Property("IsRecommended"); + + 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/20170428110754_4281.cs b/CC98.Software/src/CC98.Software/Migrations/20170428110754_4281.cs new file mode 100644 index 0000000..605090f --- /dev/null +++ b/CC98.Software/src/CC98.Software/Migrations/20170428110754_4281.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace CC98.Software.Migrations +{ + public partial class _4281 : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Filename", + table: "Softwares", + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Filename", + table: "Softwares"); + } + } +} diff --git a/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs b/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs index 083e335..1fcc04b 100644 --- a/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs +++ b/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs @@ -95,6 +95,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("FileLocation"); + b.Property("Filename"); + b.Property("Introduction"); b.Property("IsAccepted"); diff --git a/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml index b28d5dd..a96ec34 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml @@ -1,17 +1,7 @@ @using Microsoft.AspNetCore.Authorization @model Software @inject IAuthorizationService Authorization -
-
-
-
-

-

- -
-

-
-
+ @if (await Authorization.AuthorizeAsync(User, "Manage")) { @@ -56,6 +46,7 @@
@Model.DownloadNum
下载数
+下载 //分页 @@ -86,10 +77,7 @@
@i.Commenttime
} - - - - +
diff --git a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml index 4af194b..cf22828 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml @@ -16,7 +16,7 @@ @foreach (Software i in Model) {
...
diff --git a/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml b/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml index b609007..428ab82 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml @@ -9,7 +9,7 @@ (1.软件名称2.软件图标3.软件分类4.软件适用平台5.软件功能简介6.安装说明7.文件的ftp地址 2.http上传模式 除了以上表单内容除第七项以外,新增上传界面(推荐小文件上传)*/ } -
+ 上传文件

上传软件图标
From 707b7dad7b89bc8d2cb455cd73d39a62b4714f33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E7=8F=BA=20=E7=94=B0?= Date: Fri, 28 Apr 2017 20:51:57 +0800 Subject: [PATCH 29/38] =?UTF-8?q?=E4=BF=A1=E7=AE=B1=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E9=87=8D=E5=86=99=20=E6=B5=8B=E8=AF=95=E5=AE=8C=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CC98.Software/.gitattributes | 63 +++++ CC98.Software/.gitignore | 261 ++++++++++++++++++ .../Controllers/HomeController.cs | 8 +- .../src/CC98.Software/Views/Home/Index.cshtml | 153 +++++----- .../src/CC98.Software/Views/Home/List.cshtml | 119 +++----- .../Views/Home/Messagebox.cshtml | 20 +- .../Views/Home/RecommendSoftware.cshtml | 5 - .../CC98.Software/Views/Home/Search.cshtml | 1 - .../Views/Home/ShowUpload.cshtml | 24 ++ .../CC98.Software/Views/Home/inList.cshtml | 3 - 10 files changed, 470 insertions(+), 187 deletions(-) create mode 100644 CC98.Software/.gitattributes create mode 100644 CC98.Software/.gitignore delete mode 100644 CC98.Software/src/CC98.Software/Views/Home/RecommendSoftware.cshtml create mode 100644 CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml delete mode 100644 CC98.Software/src/CC98.Software/Views/Home/inList.cshtml 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/src/CC98.Software/Controllers/HomeController.cs b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs index cedec98..62a03dc 100644 --- a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs +++ b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs @@ -143,16 +143,16 @@ public async Task New2Category(string name, int id, [FromServices } [Authorize] - public async Task SendMessage(SMessage p, [FromServices] SoftwareDbContext q) + public async Task SendMessage(string Receivername,string Title,string Content, [FromServices] SoftwareDbContext q) { Data.Feedback newmes = new Data.Feedback { - Message = p.Content, - ReceiverName = p.Receivername, + Message = Content, + ReceiverName = Receivername, Time = DateTimeOffset.Now, - Title = p.Title, + Title = Title, SenderName = User.Identity.Name, }; q.Feedbacks.Add(newmes); diff --git a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml index ae54fff..147daaf 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml @@ -1,154 +1,147 @@ @using Microsoft.Extensions.Options - @inject IOptions Setting - @model Category[] - @{ - - ViewData["Title"] = "首页-CC98软件站"; - + ViewData["Title"] = "首页-CC98软件站"; } -
-
+
+ +
-
- -

软件推荐

- -
-
+

软件推荐

+
+
- @*调试1*@ -
-

软件分类

+ @*调试1*@ +
-
+

软件分类

- @foreach (Category i in Model) +
- { + @foreach (Category i in Model) - if (i.Parent == null) + { - { + if (i.Parent == null) -
@i.Name
+ { - } +
@i.Name
- else + } - { + else -
+ { - @foreach (Category p in i.Children) +
- { + @foreach (Category p in i.Children) - @p.Name + { - } + @p.Name + } -
+ - } + } - } + } -
+
-
+
-
-
-

常用软件集合

+
+
+

常用软件集合

- + - + - @*这里是引用了两个分页*@ -
-
+ @*这里是引用了两个分页*@ +
+
- -
-
-
+
+
+
-

常玩游戏下载

+

常玩游戏下载

- hhh + hhh -
+
diff --git a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml index 9ca3cfb..cf22828 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml @@ -1,114 +1,71 @@ -@model Software[] +@model Software[]

-
+
-
- 图片 -
-
- -
- + +
-

-
-
@foreach (Software i in Model) { +
+ +
+
+
...
+
+ @i.Introduction +

@i.DownloadNum 评论数

+
+
+ } + + +
- +

-
- ... -
-
-
- @i.Introduction - 这里是内容 哈哈哈哈哈哈哈哈哈哈哈哈哈哈asda哈哈哈哈sada a dsa asd as da 哈哈asdssssss asdasdas dasd哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈 -
-
-

下载数:@i.DownloadNum  评论数:i.Comments.Count  时间:@i.UpdateTime  上传者:@i.UploaderName

-
-
+

+
+
+ 热门应用 +
应用 +
应用
+
+ + -
- }
-
+
- @for (int page = 1; page <= ViewBag.amount / 10 + 1; page++) - { - @page - } - 下一页 + @for(int page = 1; page <=ViewBag.amount/10+1; page++) { + + @page + } + 下一页
-
- 1  - n +
+ 1  + n
-
-
-

-
热门应用
-
1
-
- -
-
- -
- -
-
-
-
-
-
-
-

用户专区

- -
-
-

我要上传

- -
-
-

我要反馈

- -
-
-

FTP上传工具

- -
-
-
-
+
diff --git a/CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml index a38b41d..bb923cf 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml @@ -8,19 +8,13 @@
- -
- - -
-
- - -
-
- - -
+ + 收件人
+
+ 标题
+
+ 内容
+
diff --git a/CC98.Software/src/CC98.Software/Views/Home/RecommendSoftware.cshtml b/CC98.Software/src/CC98.Software/Views/Home/RecommendSoftware.cshtml deleted file mode 100644 index e1dd794..0000000 --- a/CC98.Software/src/CC98.Software/Views/Home/RecommendSoftware.cshtml +++ /dev/null @@ -1,5 +0,0 @@ -@* - For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 -*@ -@{ -} diff --git a/CC98.Software/src/CC98.Software/Views/Home/Search.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Search.cshtml index d8a16bd..57bd031 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Search.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Search.cshtml @@ -1,3 +1,2 @@ @model Software[] - @Html.Partial("List", Model); diff --git a/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml b/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml new file mode 100644 index 0000000..428ab82 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml @@ -0,0 +1,24 @@ +@* + For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 +*@ +@model UploadWare +@{ + /*功能主要包括: + 需要用户登录 + 1.ftp上传模式下,上传用户填写表单,表单内容包括 + (1.软件名称2.软件图标3.软件分类4.软件适用平台5.软件功能简介6.安装说明7.文件的ftp地址 + 2.http上传模式 除了以上表单内容除第七项以外,新增上传界面(推荐小文件上传)*/ +} +
+ 上传文件
+
+ 上传软件图标
+
+ 软件名称
+ 软件介绍
+ 软件适用平台Windows + Mac + Android + Ios
+
+ \ No newline at end of file diff --git a/CC98.Software/src/CC98.Software/Views/Home/inList.cshtml b/CC98.Software/src/CC98.Software/Views/Home/inList.cshtml deleted file mode 100644 index d8a16bd..0000000 --- a/CC98.Software/src/CC98.Software/Views/Home/inList.cshtml +++ /dev/null @@ -1,3 +0,0 @@ -@model Software[] - -@Html.Partial("List", Model); From 0b6e7989208b749273279db4561d5d39eaa2479f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?y=E6=96=B9=E7=AD=89=E4=BA=8E4x?= Date: Mon, 1 May 2017 21:24:49 +0800 Subject: [PATCH 30/38] =?UTF-8?q?5.1=20=E5=89=8D=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/CC98.Software/Views/Home/List.cshtml | 107 +++++++----- .../Views/Home/Messagebox.cshtml | 157 ++++++++++++------ 2 files changed, 177 insertions(+), 87 deletions(-) diff --git a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml index cf22828..4b30e5f 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml @@ -1,4 +1,4 @@ -@model Software[] +@model Software[]

@@ -6,65 +6,96 @@
- - -
-

-

-
+
@foreach (Software i in Model) { -
- -
-
-
...
-
- @i.Introduction -

@i.DownloadNum 评论数

-
-
- } - - -
-
-

-
-

+
- 热门应用 -
应用 -
应用 +
...
+
+ @i.Introduction +

@i.DownloadNum 评论数

+
-
- - +
+ }
-
+
- @for(int page = 1; page <=ViewBag.amount/10+1; page++) { - - @page - } - 下一页 + @for (int page = 1; page <= ViewBag.amount / 10 + 1; page++) + { + + @page + } + 下一页
-
+
1n
+
+
+
+

+
+
+

+
+
+ 热门应用 +
应用 +
应用 +
+
+
+
+
+
+
+
+
+

用户专区

+ +
+
+

我要上传

+ +
+
+

我要反馈

+ +
+
+

FTP上传工具

+ +
+
+
+
+
+
+ +
diff --git a/CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml index bb923cf..66fcfe2 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml @@ -1,63 +1,122 @@ @model Feedback[] -
-
-

Send Message

-
-
+
+
+
+
-
-
-
- 收件人
-
- 标题
-
- 内容
-
- - -
-
-
-
-
-
    @p.Name;
    @p.Name
- - - - - @foreach (Feedback i in Model) +
+
+

发送邮件

+
+
+ +
+ + + + + +
+ + + +
+ + + +
+ + + +
+
+
+
+
+

发件箱

+
+
+
+
+

标题

+ @foreach (Feedback i in Model) { if (i.SenderName == User.Identity.Name) { -
- - - } +
+ +
} + } + + + +
+
+
+

收件人

+ @foreach (Feedback i in Model) + { + if (i.SenderName == User.Identity.Name) + { +
+ +
} } -
标题收件人
@i.Title @i.ReceiverName
- -
-
-
- - - - - - @foreach (Feedback i in Model) + + + + + + + +
+
+
+
+

收件箱

+
+
+
+
+

标题

+ @foreach (Feedback i in Model) { if (i.ReceiverName == User.Identity.Name) { -
- - - - } - } -
标题发件人
@i.Title @i.SenderName
+
+ +
+ } + } +
+ + +
+
+
+
+

发件人

+ @foreach (Feedback i in Model) + { + if (i.ReceiverName == User.Identity.Name) + { +
+ +
+ } + } +
+
+ +
+
+
+ + + + From eb75db29bd4c7fb0d607c63c1e6e9e7dd98b4500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?y=E6=96=B9=E7=AD=89=E4=BA=8E4x?= Date: Wed, 3 May 2017 23:38:26 +0800 Subject: [PATCH 31/38] 5.3 box in detial & details --- .../CC98.Software/Views/Home/Details.cshtml | 206 ++++++++++++------ .../src/CC98.Software/Views/Home/List.cshtml | 2 +- .../Views/Home/MessageDetail.cshtml | 112 ++++++++-- 3 files changed, 228 insertions(+), 92 deletions(-) diff --git a/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml index a96ec34..e5038a1 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml @@ -6,91 +6,153 @@ { } -
-
@Model.Name
- -
+
+
+
+
+
+
+

详细信息

+
+
+
+
+ +
+
+
-
-
@Model.Introduction
-
简介
-
+
+

软件名

+ +
-
-
游戏贴图
//有图片地址 -
...
-
...
-
...
-
+
+
简介
+
@Model.Introduction
+
-
-
@Model.Size
-
大小
-
+
+
游戏贴图
//有图片地址 +
...
+
...
+
-
-
@Model.Class
-
类别
-
+
+
大小
+
@Model.Size
+
-
-
@Model.UpdateTime
-
时间
-
-
-
@Model.UploaderName
-
上传者
-
+
+
类别
+
@Model.Class
+
-
-
@Model.DownloadNum
-
下载数
-
-下载 -//分页 - - - - -
-
评论数
-
评论数
-
+
+
上传时间
+
@Model.UpdateTime
+
+
+
上传者
+
@Model.UploaderName
+
-
-

-
+
+
下载数
+
@Model.DownloadNum
+
-
-
-
-

相关评论

-
-
-
+ 下载 + //分页 + + + + -
-
-
- @foreach (var i in @Model.Comments) { -
@i.Contents
-
@i.Commenttime
} +
+
评论数
+
@i.DownloadNum
+
+
-
- - -
+
+
+
- - 当前页码 - +
+
+

相关评论

+
+
+ +
+
+
+ @foreach (var i in @Model.Comments) + { +
@i.Contents
+
@i.Commenttime
} +
+
+ + +
+
+
+ + @for (int page = 1; page <= ViewBag.amount / 10 + 1; page++) + { + + @page + } + 下一页 +
+
+
+
+
+ 1  + n +
+
-
-
- 1  - n +
+
+
+
+
+
+
+
+
+
+

用户专区

+ +
+
+

我要上传

+ +
+
+

我要反馈

+ +
+
+

FTP上传工具

+ +
+
+
-
\ No newline at end of file + \ No newline at end of file diff --git a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml index 4b30e5f..f91ebd1 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml @@ -36,7 +36,7 @@
-
+
1n
diff --git a/CC98.Software/src/CC98.Software/Views/Home/MessageDetail.cshtml b/CC98.Software/src/CC98.Software/Views/Home/MessageDetail.cshtml index 18f2a41..bc6d07f 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/MessageDetail.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/MessageDetail.cshtml @@ -2,22 +2,96 @@ @model Feedback @{ } -
-

详细信息

- - - - - - - - - - - - - - - -
标题发信人收信人日期详情
@Model.Title;@Model.SenderName@Model.SenderName@Model.Time@Model.Message
-
\ No newline at end of file +
+
+
+
+
+
+
+

详细信息

+
+
+
+ +
+
+

标题

+
+
+

@Model.Title

+
+
+
+
+

发件人

+
+
+

@Model.SenderName

+
+
+
+
+

收件人

+
+
+

@Model.SenderName

+
+
+
+
+

日期

+
+
+

@Model.Time

+
+
+ +
+
+

详情

+
+
+

@Model.Message

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

用户专区

+ +
+
+

我要上传

+ +
+
+

我要反馈

+ +
+
+

FTP上传工具

+ +
+
+
+
+
+
From 3c42bb3e00a124d83ad2cbcde6ae0dfce688ed09 Mon Sep 17 00:00:00 2001 From: MoLan1980 <775026348@qq.com> Date: Fri, 5 May 2017 00:17:48 +0800 Subject: [PATCH 32/38] =?UTF-8?q?=E6=9B=B4=E6=AD=A3=E4=B8=8A=E6=96=B9?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=90=9C=E7=B4=A2=E6=A1=86=E5=9E=82=E7=9B=B4?= =?UTF-8?q?=E5=B1=85=E4=B8=AD=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml b/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml index 9a14bd9..f38daa4 100644 --- a/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml @@ -39,10 +39,10 @@ }
  • 信箱
  • -
  • +
  • - -
  • + +
  • 登录
  • From bae127aa6647481b14516d61cd34ed91787e9228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E7=8F=BA=20=E7=94=B0?= Date: Fri, 5 May 2017 18:25:26 +0800 Subject: [PATCH 33/38] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B3=A8=E9=94=80=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BF=BB=E9=A1=B5=20=E6=94=B9=E8=BF=9B?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E5=90=8D=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/AccountController.cs | 6 ++ .../Controllers/HomeController.cs | 48 ++++++++-------- .../Controllers/TestdbController.cs | 6 +- .../src/CC98.Software/Data/Comment.cs | 8 +-- .../src/CC98.Software/Data/Manager.cs | 2 +- .../src/CC98.Software/Data/SMessage.cs | 18 ------ .../src/CC98.Software/Data/Setting.cs | 2 + .../CC98.Software/Views/Home/Details.cshtml | 47 ++-------------- .../src/CC98.Software/Views/Home/Index.cshtml | 6 +- .../src/CC98.Software/Views/Home/List.cshtml | 37 +++++------- .../Views/Home/Messagebox.cshtml | 56 +++++++++++-------- .../CC98.Software/Views/Home/Search.cshtml | 1 + .../Views/Home/ShowUpload.cshtml | 20 +++---- .../CC98.Software/Views/Shared/_Layout.cshtml | 23 ++++---- .../src/CC98.Software/appsettings.json | 4 +- 15 files changed, 122 insertions(+), 162 deletions(-) delete mode 100644 CC98.Software/src/CC98.Software/Data/SMessage.cs 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 62a03dc..1298b8a 100644 --- a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs +++ b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs @@ -22,27 +22,28 @@ public async Task Index([FromServices] SoftwareDbContext q) return View(m); } - public async Task Upload(UploadWare m, [FromServices] SoftwareDbContext q) + [ValidateAntiForgeryToken] + public async Task Upload(UploadWare model, [FromServices] SoftwareDbContext dbContext,[FromServices]IOptions setting) { - System.IO.FileStream a = System.IO.File.OpenWrite(System.IO.Path.Combine("C:\\Test\\", m.Name)); - await m.File.CopyToAsync(a); - System.IO.FileStream b = System.IO.File.OpenWrite(System.IO.Path.Combine("C:\\Test\\Gra", m.Name)); - await m.Photo.CopyToAsync(b); + System.IO.FileStream a = System.IO.File.OpenWrite(System.IO.Path.Combine("C:\\Test\\", model.Name)); + await model.File.CopyToAsync(a); + System.IO.FileStream b = System.IO.File.OpenWrite(System.IO.Path.Combine("C:\\Test\\Gra", model.Name)); + await model.Photo.CopyToAsync(b); //新开空文件 返回文件流 将IFormFile格式文件转为FileStream存入本地服务器 Data.Software newfile = new Data.Software { - Name=m.Name, - Introduction = m.Introduction, - Platform = m.Platform, - FileLocation = System.IO.Path.Combine("C:\\Test\\", m.Name), - PhotoLocation = System.IO.Path.Combine("C:\\Test\\Gra", m.Name), + 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=m.File.FileName, + Filename=model.File.FileName, }; - q.Softwares.Add(newfile); - await q.SaveChangesAsync(true); + dbContext.Softwares.Add(newfile); + await dbContext.SaveChangesAsync(true); return View("AfterUploading"); } public IActionResult ShowUpload() @@ -58,10 +59,10 @@ public IActionResult Error() } [Authorize("Manage")] - public async Task Background([FromServices] SoftwareDbContext q) + public async Task Background([FromServices] SoftwareDbContext dbContext) { Data.Software[] m; - var result = from i in q.Softwares select i; + var result = from i in dbContext.Softwares select i; m = await result.ToArrayAsync(); return View(m); } @@ -178,14 +179,16 @@ public async Task Details(int id, [FromServices] SoftwareDbContex Data.Software m = await q.Softwares.FindAsync(id); return View(m); } - public async Task InList(int page, int classid, [FromServices] SoftwareDbContext q) + public async Task InList( int Classid, [FromServices] SoftwareDbContext q,int page=1) { - page++; - ViewBag.curPage = page; - var b = from i in q.Softwares where i.Class.Id == classid select i; + + ViewBag.curPage = page; + ViewBag.ShowButton = true; + ViewBag.Classid = Classid; + var b = from i in q.Softwares where i.Class.Id == Classid select i; ViewBag.amount =await b.CountAsync(); - var m = b.Skip(10 * (page - 1)).Take(10); - return View(await m.ToArrayAsync()); + var m = b.Skip(10 * (page-1) ).Take(10); + return View("List",await m.ToArrayAsync()); } public async Task changeFrequencyT(int id, [FromServices]Data.SoftwareDbContext q) @@ -221,6 +224,7 @@ public async Task Search([FromServices]SoftwareDbContext dbcontex var x = from i in dbcontext.Softwares where i.Name.Contains(content) select i; + ViewBag.ShowButton = false; return View(await x.ToArrayAsync()); } @@ -229,7 +233,7 @@ public async Task DeleteSoftware(int id,[FromServices]SoftwareDbC var x = q.Softwares.Find(id); q.Softwares.Remove(x); await q.SaveChangesAsync(); - return View("Index"); + return RedirectToAction("Index"); } public IActionResult Download(int id,[FromServices]SoftwareDbContext q) diff --git a/CC98.Software/src/CC98.Software/Controllers/TestdbController.cs b/CC98.Software/src/CC98.Software/Controllers/TestdbController.cs index 8111bc4..aa2180c 100644 --- a/CC98.Software/src/CC98.Software/Controllers/TestdbController.cs +++ b/CC98.Software/src/CC98.Software/Controllers/TestdbController.cs @@ -35,11 +35,11 @@ public IActionResult AddDbcomment([FromServices]Data.SoftwareDbContext q) for (int i = 1; i <= 100; i++) { Data.Comment s = new Data.Comment(); - s.Commenttime = DateTimeOffset.Now; - s.Contents = i + "abc"; + s.Time = DateTimeOffset.Now; + s.Content = i + "abc"; Data.Software p = new Data.Software(); p.Id = i / 3 + 1; - s.CommentBelongto = p; + s.Software = p; q.Comments.Add(s); } q.SaveChanges(true); diff --git a/CC98.Software/src/CC98.Software/Data/Comment.cs b/CC98.Software/src/CC98.Software/Data/Comment.cs index e74dbf2..91ebc68 100644 --- a/CC98.Software/src/CC98.Software/Data/Comment.cs +++ b/CC98.Software/src/CC98.Software/Data/Comment.cs @@ -10,10 +10,10 @@ namespace CC98.Software.Data { public class Comment { - public string Contents { get; set; } - public DateTimeOffset Commenttime { get; set; } - public Software CommentBelongto { get; set; } - public string Name { get; set; } + 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/Manager.cs b/CC98.Software/src/CC98.Software/Data/Manager.cs index e94cd34..9127682 100644 --- a/CC98.Software/src/CC98.Software/Data/Manager.cs +++ b/CC98.Software/src/CC98.Software/Data/Manager.cs @@ -5,7 +5,7 @@ namespace CC98.Software.Data { - public class Manager + public class Message { public string Name { get; set; } public int Id { get; set; } diff --git a/CC98.Software/src/CC98.Software/Data/SMessage.cs b/CC98.Software/src/CC98.Software/Data/SMessage.cs deleted file mode 100644 index c9842d3..0000000 --- a/CC98.Software/src/CC98.Software/Data/SMessage.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace CC98.Software.Data -{ - public class SMessage - { - public string Content - { - get; set; - } - public string Title { get; set; } - public int Id { get; set; } - public string Receivername { get; set; } - } -} diff --git a/CC98.Software/src/CC98.Software/Data/Setting.cs b/CC98.Software/src/CC98.Software/Data/Setting.cs index f24a703..c8974a0 100644 --- a/CC98.Software/src/CC98.Software/Data/Setting.cs +++ b/CC98.Software/src/CC98.Software/Data/Setting.cs @@ -10,6 +10,8 @@ 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/Views/Home/Details.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml index e5038a1..efd268b 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml @@ -4,7 +4,7 @@ @if (await Authorization.AuthorizeAsync(User, "Manage")) { - + 删除 }
    @@ -16,9 +16,7 @@
    -
    - -
    +
    @@ -71,7 +69,7 @@
    评论数
    -
    @i.DownloadNum
    +
    @Model.DownloadNum
    @@ -91,8 +89,8 @@
    @foreach (var i in @Model.Comments) { -
    @i.Contents
    -
    @i.Commenttime
    } +
    @i.Content
    +
    @i.Time
    }
    @@ -121,38 +119,3 @@

    - \ No newline at end of file diff --git a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml index 147daaf..36321a7 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml @@ -31,7 +31,7 @@ { -
    @i.Name
    +
    @i.Name
    } @@ -45,7 +45,7 @@ { - @p.Name + @p.Name } @@ -67,7 +67,7 @@ - @*这里是引用了两个分页*@ + diff --git a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml index f91ebd1..3fc2c12 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml @@ -12,7 +12,7 @@ {
    -
    +
    ...
    @@ -23,26 +23,17 @@
    } -
    -
    -
    - - @for (int page = 1; page <= ViewBag.amount / 10 + 1; page++) - { - - @page - } - 下一页 -
    -
    -
    -
    - 1  - n -
    -
    -
    -
    + @if(ViewBag.ShowButton) + {
    + + +
    + } + +
    @@ -58,7 +49,7 @@

    -
    + - + diff --git a/CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml index 66fcfe2..1f8e9f3 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml @@ -1,36 +1,44 @@ @model Feedback[] -
    -
    -
    -
    -
    -
    -

    发送邮件

    -
    -
    -
    +
    -
    +
    - - -
    +

    Send Message

    - - -
    +
    - - -
    +
    - - -
    -
    + + +
    + +
    + +
    + + 收件人
    + +
    + + 标题
    + +
    + + 内容
    + +
    + + + +
    + +
    + +
    diff --git a/CC98.Software/src/CC98.Software/Views/Home/Search.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Search.cshtml index 57bd031..666ab6b 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Search.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Search.cshtml @@ -1,2 +1,3 @@ @model Software[] + @Html.Partial("List", Model); diff --git a/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml b/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml index 428ab82..0dbabfd 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml @@ -1,17 +1,17 @@ @* For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 -*@ +*@ @model UploadWare @{ - /*功能主要包括: - 需要用户登录 - 1.ftp上传模式下,上传用户填写表单,表单内容包括 - (1.软件名称2.软件图标3.软件分类4.软件适用平台5.软件功能简介6.安装说明7.文件的ftp地址 - 2.http上传模式 除了以上表单内容除第七项以外,新增上传界面(推荐小文件上传)*/ -} -
    - 上传文件
    -
    +/*功能主要包括: + 需要用户登录 + 1.ftp上传模式下,上传用户填写表单,表单内容包括 +(1.软件名称2.软件图标3.软件分类4.软件适用平台5.软件功能简介6.安装说明7.文件的ftp地址 + 2.http上传模式 除了以上表单内容除第七项以外,新增上传界面(推荐小文件上传)*/ +} + + 上传文件
    +
    上传软件图标

    软件名称
    diff --git a/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml b/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml index f38daa4..4e56356 100644 --- a/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml @@ -33,19 +33,20 @@
    diff --git a/CC98.Software/src/CC98.Software/appsettings.json b/CC98.Software/src/CC98.Software/appsettings.json index 03f59aa..c114194 100644 --- a/CC98.Software/src/CC98.Software/appsettings.json +++ b/CC98.Software/src/CC98.Software/appsettings.json @@ -18,7 +18,9 @@ }, "WebsiteAddress":{ "FeedbackWeb": "http://www.baidu.com", - "RequireWeb":"http://www.hao123.com" + "RequireWeb": "http://www.hao123.com", + "SaveFileAddress": "C:\\Test", + "SaveGraAddress": "C:\\Test\\gra" } } From 88a74651793f65c4ce6ddddda94eea8ebdf61c75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E7=8F=BA=20=E7=94=B0?= Date: Fri, 5 May 2017 21:54:09 +0800 Subject: [PATCH 34/38] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E5=8C=85=E4=B9=8B=E5=90=8E=E7=9A=84=E7=BF=BB=E9=A1=B5=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=8C=E6=90=9C=E7=B4=A2=20=E4=BF=A1=E7=AE=B1?= =?UTF-8?q?=E9=87=8D=E6=9E=84=20=EF=BC=8C=E5=88=86=E7=B1=BB=E7=BF=BB?= =?UTF-8?q?=E9=A1=B5=E9=87=8D=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/CC98.Software/CC98.Software.csproj | 4 + .../Controllers/HomeController.cs | 474 +++++++++--------- .../Controllers/TestdbController.cs | 48 +- .../src/CC98.Software/Data/Manager.cs | 13 - .../src/CC98.Software/Data/Software.cs | 2 +- .../CC98.Software/Data/SoftwareDbContext.cs | 2 +- .../FrequentSoftwaresViewComponent.cs | 4 +- .../HotSoftwaresViewComponent.cs | 4 +- .../Migrations/20170505121102_552.Designer.cs | 138 +++++ .../Migrations/20170505121102_552.cs | 106 ++++ .../SoftwareDbContextModelSnapshot.cs | 26 +- CC98.Software/src/CC98.Software/Startup.cs | 6 + .../Views/Home/Background.cshtml | 2 +- .../Views/Home/CategoryManagement.cshtml | 4 +- .../CC98.Software/Views/Home/Details.cshtml | 10 +- .../src/CC98.Software/Views/Home/Inbox.cshtml | 43 ++ .../src/CC98.Software/Views/Home/Index.cshtml | 4 +- .../src/CC98.Software/Views/Home/List.cshtml | 132 +++-- .../Views/Home/MessageDetail.cshtml | 2 +- .../Views/Home/Messagebox.cshtml | 94 +--- .../CC98.Software/Views/Home/Outbox.cshtml | 43 ++ .../CC98.Software/Views/Home/Search.cshtml | 5 +- .../FrequentSoftwares/Default.cshtml | 2 +- .../Components/HotSoftwares/Default.cshtml | 2 +- .../CC98.Software/Views/Shared/_Layout.cshtml | 4 +- .../CC98.Software/Views/_ViewImports.cshtml | 1 + 26 files changed, 704 insertions(+), 471 deletions(-) delete mode 100644 CC98.Software/src/CC98.Software/Data/Manager.cs create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170505121102_552.Designer.cs create mode 100644 CC98.Software/src/CC98.Software/Migrations/20170505121102_552.cs create mode 100644 CC98.Software/src/CC98.Software/Views/Home/Inbox.cshtml create mode 100644 CC98.Software/src/CC98.Software/Views/Home/Outbox.cshtml diff --git a/CC98.Software/src/CC98.Software/CC98.Software.csproj b/CC98.Software/src/CC98.Software/CC98.Software.csproj index 8f5bee4..67e5054 100644 --- a/CC98.Software/src/CC98.Software/CC98.Software.csproj +++ b/CC98.Software/src/CC98.Software/CC98.Software.csproj @@ -39,6 +39,10 @@ + + + + diff --git a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs index 1298b8a..435ac81 100644 --- a/CC98.Software/src/CC98.Software/Controllers/HomeController.cs +++ b/CC98.Software/src/CC98.Software/Controllers/HomeController.cs @@ -6,240 +6,252 @@ 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 int amount; - public async Task Index([FromServices] SoftwareDbContext q) - { - Data.Category[] m; - var result = from i in q.Categories select i; - m = await result.ToArrayAsync(); - return View(m); - } - - [ValidateAntiForgeryToken] - public async Task Upload(UploadWare model, [FromServices] SoftwareDbContext dbContext,[FromServices]IOptions setting) - { - System.IO.FileStream a = System.IO.File.OpenWrite(System.IO.Path.Combine("C:\\Test\\", model.Name)); - await model.File.CopyToAsync(a); - System.IO.FileStream b = System.IO.File.OpenWrite(System.IO.Path.Combine("C:\\Test\\Gra", model.Name)); - await model.Photo.CopyToAsync(b); - //新开空文件 返回文件流 将IFormFile格式文件转为FileStream存入本地服务器 - Data.Software 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) - { - Data.Software[] m; - var result = from i in dbContext.Softwares select i; - m = await result.ToArrayAsync(); - return View(m); - } - - public async Task UnAccepted(int id, [FromServices] SoftwareDbContext q) - { - Data.Software m; - m = q.Softwares.Find(id); - if (m == null) - { - return NotFound(); - } - else - { - q.Softwares.Remove(m); - } - await q.SaveChangesAsync(true); - return RedirectToAction("Background"); - } - - public async Task Accepted(int id, [FromServices] SoftwareDbContext q) - { - Data.Software m; - m = q.Softwares.Find(id); - if (m == null) - { - return NotFound(); - } - else - { - m.IsAccepted = true; - } - await q.SaveChangesAsync(true); - return RedirectToAction("Background"); - } - - public async Task NewCategory(string name, [FromServices] SoftwareDbContext q) - { - Data.Category m = new Category(); - m.Name = name; - q.Categories.Add(m); - await q.SaveChangesAsync(true); - return RedirectToAction("CategoryManagement"); - } - - public async Task Delete(int id, [FromServices] SoftwareDbContext q) - { - Category m; - m =await q.Categories.FindAsync(id); - if (m == null) - { - return NotFound(); - } - else - { - q.Categories.Remove(m); - } - await q.SaveChangesAsync(true); - return RedirectToAction("CategoryManagement"); - } - - public async Task CategoryManagement([FromServices] SoftwareDbContext q) - { - Category[] m; - var result = from i in q.Categories select i; - m = await result.ToArrayAsync(); - return View(m); ; - } - - public async Task New2Category(string name, int id, [FromServices] SoftwareDbContext q) - { - Data.Category m = new Category(); - Data.Category n; - n = await q.Categories.FindAsync(id); - m.Name = name; - m.Parent = n; - await q.SaveChangesAsync(true); - return RedirectToAction("CategoryManagement"); - } - - [Authorize] - public async Task SendMessage(string Receivername,string Title,string Content, [FromServices] SoftwareDbContext q) - { - - - Data.Feedback newmes = new Data.Feedback - { - Message = Content, - ReceiverName = Receivername, - Time = DateTimeOffset.Now, - Title = Title, - SenderName = User.Identity.Name, - }; - q.Feedbacks.Add(newmes); - await q.SaveChangesAsync(true); - return RedirectToAction("Messagebox"); - } - public async Task Messagebox([FromServices] SoftwareDbContext q) - { - Data.Feedback[] m; - string name = User.Identity.Name; - var result = from i in q.Feedbacks where (i.ReceiverName == name || i.SenderName == name) select i; - m = await result.ToArrayAsync(); - await q.SaveChangesAsync(true); - return View(m); - } - public async Task MessageDetail(int id, [FromServices] SoftwareDbContext q) - { - Data.Feedback m =await q.Feedbacks.FindAsync(id); - return View(m); - } - public async Task Details(int id, [FromServices] SoftwareDbContext q) - { - Data.Software m = await q.Softwares.FindAsync(id); - return View(m); - } - public async Task InList( int Classid, [FromServices] SoftwareDbContext q,int page=1) - { - - ViewBag.curPage = page; - ViewBag.ShowButton = true; - ViewBag.Classid = Classid; - var b = from i in q.Softwares where i.Class.Id == Classid select i; - ViewBag.amount =await b.CountAsync(); - var m = b.Skip(10 * (page-1) ).Take(10); - return View("List",await m.ToArrayAsync()); - } - - public async Task changeFrequencyT(int id, [FromServices]Data.SoftwareDbContext q) - { - Data.Software p = q.Softwares.Find(id); - p.IsFrequent = true; - await q.SaveChangesAsync(true); - return RedirectToAction("Details"); - } - public async Task changeFrequencyF(int id, [FromServices]Data.SoftwareDbContext q) - { - Data.Software p = q.Softwares.Find(id); - p.IsFrequent = false; - await q.SaveChangesAsync(true); - return RedirectToAction("Details"); - } - public async Task changeRecommendationT(int id, [FromServices]Data.SoftwareDbContext q) - { - Data.Software p = q.Softwares.Find(id); - p.IsRecommended = true; - await q.SaveChangesAsync(true); - return RedirectToAction("Details"); - } - public async Task changeRecommendationF(int id, [FromServices]Data.SoftwareDbContext q) - { - Data.Software p = q.Softwares.Find(id); - p.IsRecommended = false; - await q.SaveChangesAsync(true); - return RedirectToAction("Details"); - } - public async Task Search([FromServices]SoftwareDbContext dbcontext, string content) - { - var x = from i in dbcontext.Softwares - where i.Name.Contains(content) - select i; - ViewBag.ShowButton = false; - return View(await x.ToArrayAsync()); - } - - public async Task DeleteSoftware(int id,[FromServices]SoftwareDbContext q) - { - var x = q.Softwares.Find(id); - q.Softwares.Remove(x); - await q.SaveChangesAsync(); - return RedirectToAction("Index"); - } - - public IActionResult Download(int id,[FromServices]SoftwareDbContext q) - { - var x = q.Softwares.Find(id); - return PhysicalFile(x.FileLocation, "application/octet-stream",x.Filename); - } - } + 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 index aa2180c..d9835c6 100644 --- a/CC98.Software/src/CC98.Software/Controllers/TestdbController.cs +++ b/CC98.Software/src/CC98.Software/Controllers/TestdbController.cs @@ -11,51 +11,53 @@ namespace CC98.Software.Controllers public class TestdbController : Controller { // GET: // - public IActionResult AddDb([FromServices]Data.SoftwareDbContext q) + public IActionResult AddDb([FromServices]Data.SoftwareDbContext dbContext) { - for (int i = 1; i <= 100; i++) + for (var i = 1; i <= 100; i++) { - Data.Software s = new Data.Software(); - s.Name = i.ToString(); - s.DownloadNum = 1; - s.IsAccepted = false; - s.IsFrequent = false; - s.Size = 1; - s.UpdateTime = DateTimeOffset.Now; - s.Platform = Data.Platform.Android; - q.Softwares.Add(s); + 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); } - q.SaveChanges(true); + dbContext.SaveChanges(true); return RedirectToAction("index", "home"); } - public IActionResult AddDbcomment([FromServices]Data.SoftwareDbContext q) + public IActionResult AddDbcomment([FromServices]Data.SoftwareDbContext dbContext) { - for (int i = 1; i <= 100; i++) + for (var i = 1; i <= 100; i++) { - Data.Comment s = new Data.Comment(); + var s = new Data.Comment(); s.Time = DateTimeOffset.Now; s.Content = i + "abc"; - Data.Software p = new Data.Software(); + var p = new Data.Software(); p.Id = i / 3 + 1; s.Software = p; - q.Comments.Add(s); + dbContext.Comments.Add(s); } - q.SaveChanges(true); + dbContext.SaveChanges(true); return RedirectToAction("index", "home"); } - public IActionResult AddDbfeedback([FromServices]Data.SoftwareDbContext q) + public IActionResult AddDbfeedback([FromServices]Data.SoftwareDbContext dbContext) { - for (int i = 1; i <= 100; i++) + for (var i = 1; i <= 100; i++) { - Data.Feedback s = new Data.Feedback(); + var s = new Data.Feedback(); s.Time = DateTimeOffset.Now; s.Title = i + "abc"; s.Message = i + "abcdefg"; - q.Feedbacks.Add(s); + dbContext.Feedbacks.Add(s); } - q.SaveChanges(true); + dbContext.SaveChanges(true); return RedirectToAction("index", "home"); } } diff --git a/CC98.Software/src/CC98.Software/Data/Manager.cs b/CC98.Software/src/CC98.Software/Data/Manager.cs deleted file mode 100644 index 9127682..0000000 --- a/CC98.Software/src/CC98.Software/Data/Manager.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace CC98.Software.Data -{ - public class Message - { - public string Name { get; set; } - public int Id { get; set; } - } -} diff --git a/CC98.Software/src/CC98.Software/Data/Software.cs b/CC98.Software/src/CC98.Software/Data/Software.cs index 78f2148..834fbe5 100644 --- a/CC98.Software/src/CC98.Software/Data/Software.cs +++ b/CC98.Software/src/CC98.Software/Data/Software.cs @@ -78,7 +78,7 @@ public string UploaderName public bool IsRecommended { get; set; } public string Filename { get; set; } - [InverseProperty("CommentBelongto")] + [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 2fa697e..0edd02d 100644 --- a/CC98.Software/src/CC98.Software/Data/SoftwareDbContext.cs +++ b/CC98.Software/src/CC98.Software/Data/SoftwareDbContext.cs @@ -30,6 +30,6 @@ public SoftwareDbContext(DbContextOptions options) : base(opt public virtual DbSet Categories { get; set; } public virtual DbSet Feedbacks { get; set; } public virtual DbSet Comments { get; set; } - public virtual DbSet Managers { get; set; } + } } diff --git a/CC98.Software/src/CC98.Software/FrequentSoftwaresViewComponent.cs b/CC98.Software/src/CC98.Software/FrequentSoftwaresViewComponent.cs index 036b597..8ea8cc0 100644 --- a/CC98.Software/src/CC98.Software/FrequentSoftwaresViewComponent.cs +++ b/CC98.Software/src/CC98.Software/FrequentSoftwaresViewComponent.cs @@ -9,10 +9,10 @@ namespace CC98.Software { public class FrequentSoftwaresViewComponent: Microsoft.AspNetCore.Mvc.ViewComponent { - public IViewComponentResult Invoke([FromServices] Data.SoftwareDbContext q) + public IViewComponentResult Invoke([FromServices] Data.SoftwareDbContext dbContext) { Data.Software[] m; - var result = from i in q.Softwares where i.IsFrequent select i; + 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 index 75188ba..498c57b 100644 --- a/CC98.Software/src/CC98.Software/HotSoftwaresViewComponent.cs +++ b/CC98.Software/src/CC98.Software/HotSoftwaresViewComponent.cs @@ -8,10 +8,10 @@ namespace CC98.Software { public class HotSoftwaresViewComponent:Microsoft.AspNetCore.Mvc.ViewComponent { - public IViewComponentResult Invoke([FromServices] Data.SoftwareDbContext q) + public IViewComponentResult Invoke([FromServices] Data.SoftwareDbContext dbContext) { Data.Software[] m; - var result = from i in q.Softwares orderby i.DownloadNum descending select i; + 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/20170505121102_552.Designer.cs b/CC98.Software/src/CC98.Software/Migrations/20170505121102_552.Designer.cs new file mode 100644 index 0000000..b16a00b --- /dev/null +++ b/CC98.Software/src/CC98.Software/Migrations/20170505121102_552.Designer.cs @@ -0,0 +1,138 @@ +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("20170505121102_552")] + partial class _552 + { + 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("Content"); + + b.Property("SoftwareId"); + + b.Property("Time"); + + b.Property("UserName"); + + b.HasKey("Id"); + + b.HasIndex("SoftwareId"); + + 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.Software", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClassId"); + + b.Property("DownloadNum"); + + b.Property("FileLocation"); + + b.Property("Filename"); + + b.Property("Introduction"); + + b.Property("IsAccepted"); + + b.Property("IsFrequent"); + + b.Property("IsRecommended"); + + 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", "Software") + .WithMany("Comments") + .HasForeignKey("SoftwareId"); + }); + + 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/20170505121102_552.cs b/CC98.Software/src/CC98.Software/Migrations/20170505121102_552.cs new file mode 100644 index 0000000..b4fac48 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Migrations/20170505121102_552.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Metadata; + +namespace CC98.Software.Migrations +{ + public partial class _552 : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Comments_Softwares_CommentBelongtoId", + table: "Comments"); + + migrationBuilder.DropTable( + name: "Managers"); + + migrationBuilder.RenameColumn( + name: "Name", + table: "Comments", + newName: "UserName"); + + migrationBuilder.RenameColumn( + name: "Contents", + table: "Comments", + newName: "Content"); + + migrationBuilder.RenameColumn( + name: "Commenttime", + table: "Comments", + newName: "Time"); + + migrationBuilder.RenameColumn( + name: "CommentBelongtoId", + table: "Comments", + newName: "SoftwareId"); + + migrationBuilder.RenameIndex( + name: "IX_Comments_CommentBelongtoId", + table: "Comments", + newName: "IX_Comments_SoftwareId"); + + migrationBuilder.AddForeignKey( + name: "FK_Comments_Softwares_SoftwareId", + table: "Comments", + column: "SoftwareId", + principalTable: "Softwares", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Comments_Softwares_SoftwareId", + table: "Comments"); + + migrationBuilder.RenameColumn( + name: "UserName", + table: "Comments", + newName: "Name"); + + migrationBuilder.RenameColumn( + name: "Time", + table: "Comments", + newName: "Commenttime"); + + migrationBuilder.RenameColumn( + name: "SoftwareId", + table: "Comments", + newName: "CommentBelongtoId"); + + migrationBuilder.RenameColumn( + name: "Content", + table: "Comments", + newName: "Contents"); + + migrationBuilder.RenameIndex( + name: "IX_Comments_SoftwareId", + table: "Comments", + newName: "IX_Comments_CommentBelongtoId"); + + 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.AddForeignKey( + name: "FK_Comments_Softwares_CommentBelongtoId", + table: "Comments", + column: "CommentBelongtoId", + principalTable: "Softwares", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + } +} diff --git a/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs b/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs index 1fcc04b..25958a8 100644 --- a/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs +++ b/CC98.Software/src/CC98.Software/Migrations/SoftwareDbContextModelSnapshot.cs @@ -37,17 +37,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Id") .ValueGeneratedOnAdd(); - b.Property("CommentBelongtoId"); + b.Property("Content"); - b.Property("Commenttime"); + b.Property("SoftwareId"); - b.Property("Contents"); + b.Property("Time"); - b.Property("Name"); + b.Property("UserName"); b.HasKey("Id"); - b.HasIndex("CommentBelongtoId"); + b.HasIndex("SoftwareId"); b.ToTable("Comments"); }); @@ -72,18 +72,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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.Software", b => { b.Property("Id") @@ -133,9 +121,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("CC98.Software.Data.Comment", b => { - b.HasOne("CC98.Software.Data.Software", "CommentBelongto") + b.HasOne("CC98.Software.Data.Software", "Software") .WithMany("Comments") - .HasForeignKey("CommentBelongtoId"); + .HasForeignKey("SoftwareId"); }); modelBuilder.Entity("CC98.Software.Data.Software", b => diff --git a/CC98.Software/src/CC98.Software/Startup.cs b/CC98.Software/src/CC98.Software/Startup.cs index 5a44a73..3fcdcc1 100644 --- a/CC98.Software/src/CC98.Software/Startup.cs +++ b/CC98.Software/src/CC98.Software/Startup.cs @@ -14,6 +14,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +using Sakura.AspNetCore.Mvc; namespace CC98.Software { @@ -59,6 +60,11 @@ public Startup(IHostingEnvironment env) public void ConfigureServices(IServiceCollection services) { services.Configure(Configuration.GetSection("WebsiteAddress")); + services.AddBootstrapPagerGenerator(options => + { + // Use default pager options. + options.ConfigureDefault(); + }); // 添加数据库功能 services.AddDbContext(options => diff --git a/CC98.Software/src/CC98.Software/Views/Home/Background.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Background.cshtml index 15e6dd2..ed83ffc 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Background.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Background.cshtml @@ -17,7 +17,7 @@ - @foreach (Software i in Model) + @foreach (var i in Model) { if (i.IsAccepted == false) { diff --git a/CC98.Software/src/CC98.Software/Views/Home/CategoryManagement.cshtml b/CC98.Software/src/CC98.Software/Views/Home/CategoryManagement.cshtml index a449076..7927df8 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/CategoryManagement.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/CategoryManagement.cshtml @@ -11,7 +11,7 @@ - @foreach (Category i in Model) + @foreach (var i in Model) { @i.Name; @@ -22,7 +22,7 @@ if (i.Parent == null) { - foreach (Category p in i.Children) + foreach (var p in i.Children) {
      @p.Name
    diff --git a/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml index efd268b..efedd25 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Details.cshtml @@ -62,10 +62,10 @@ 下载 //分页 - - - - + + + +
    评论数
    @@ -99,7 +99,7 @@
    - @for (int page = 1; page <= ViewBag.amount / 10 + 1; page++) + @for (var page = 1; page <= ViewBag.amount / 10 + 1; page++) { @page diff --git a/CC98.Software/src/CC98.Software/Views/Home/Inbox.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Inbox.cshtml new file mode 100644 index 0000000..06095d3 --- /dev/null +++ b/CC98.Software/src/CC98.Software/Views/Home/Inbox.cshtml @@ -0,0 +1,43 @@ +@model Sakura.AspNetCore.IPagedList +发邮件收件箱发件箱 + +
    +
    +

    收件箱

    +
    +
    +
    +

    标题

    + @foreach (var i in Model) + { + if (i.ReceiverName == User.Identity.Name) + { +
    + +
    + } + } +
    +
    +
    +

    发件人

    + @foreach (var i in Model) + { + if (i.ReceiverName == User.Identity.Name) + { +
    + +
    + } + } + + +
    +
    +
    +
    +
    +
    + + + diff --git a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml index 36321a7..1665389 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Index.cshtml @@ -23,7 +23,7 @@
    - @foreach (Category i in Model) + @foreach (var i in Model) { @@ -41,7 +41,7 @@
    - @foreach (Category p in i.Children) + @foreach (var p in i.Children) { diff --git a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml index 3fc2c12..35597ff 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/List.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/List.cshtml @@ -1,39 +1,30 @@ -@model Software[] - -

    -

    -

    -
    +@model Sakura.AspNetCore.IPagedList -
    -
    -
    - @foreach (Software i in Model) - { -
    - -
    -
    -
    ...
    -
    - @i.Introduction -

    @i.DownloadNum 评论数

    -
    + +
    + +
    +
    +
    + @foreach (var i in Model) + { +
    + +
    +
    +
    ...
    +
    + @i.Introduction +

    @i.DownloadNum 下载数

    -
    - } +
    +
    +} + + + + - @if(ViewBag.ShowButton) - {
    - - -
    - } - -
    @@ -49,47 +40,42 @@

    - -
    -
    -
    -
    -
    -
    -
    -

    用户专区

    - -
    -
    -

    我要上传

    - -
    -
    -

    我要反馈

    - -
    -
    -

    FTP上传工具

    - + +
    +
    +
    +
    +
    +
    +
    +

    用户专区

    + +
    +
    +

    我要上传

    + +
    +
    +

    我要反馈

    + +
    +
    +

    FTP上传工具

    + +
    -
    -
    - - - - - - - - + +
    +
    +
    diff --git a/CC98.Software/src/CC98.Software/Views/Home/MessageDetail.cshtml b/CC98.Software/src/CC98.Software/Views/Home/MessageDetail.cshtml index bc6d07f..058e5e6 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/MessageDetail.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/MessageDetail.cshtml @@ -35,7 +35,7 @@

    收件人

    -

    @Model.SenderName

    +

    @Model.ReceiverName

    diff --git a/CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml index 1f8e9f3..d22038f 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Messagebox.cshtml @@ -1,7 +1,7 @@ -@model Feedback[] - +@model Sakura.AspNetCore.IPagedList +发邮件收件箱发件箱
    @@ -39,92 +39,6 @@
    -
    -
    -
    -

    发件箱

    -
    -
    -
    -
    -

    标题

    - @foreach (Feedback i in Model) - { - if (i.SenderName == User.Identity.Name) - { -
    - -
    } - } -
    - -
    -
    - -
    -
    -
    -

    收件人

    - @foreach (Feedback i in Model) - { - if (i.SenderName == User.Identity.Name) - { -
    - -
    } - } -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    收件箱

    -
    -
    -
    -
    -

    标题

    - @foreach (Feedback i in Model) - { - if (i.ReceiverName == User.Identity.Name) - { -
    - -
    - } - } -
    -
    - -
    -
    -
    -
    -

    发件人

    - @foreach (Feedback i in Model) - { - if (i.ReceiverName == User.Identity.Name) - { -
    - -
    - } - } -
    -
    - -
    -
    -
    -
    -
    -
    -
    - + + \ No newline at end of file diff --git a/CC98.Software/src/CC98.Software/Views/Home/Outbox.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Outbox.cshtml new file mode 100644 index 0000000..079cb1a --- /dev/null +++ b/CC98.Software/src/CC98.Software/Views/Home/Outbox.cshtml @@ -0,0 +1,43 @@ + @model Sakura.AspNetCore.IPagedList +发邮件收件箱发件箱 + +
    +
    +
    +

    发件箱

    +
    +
    +
    +

    标题

    + @foreach (var i in Model) + { + if (i.SenderName == User.Identity.Name) + { +
    + +
    } + } +
    + +
    +
    + +
    +

    收件人

    + @foreach (var i in Model) + { + if (i.SenderName == User.Identity.Name) + { +
    + +
    } + } + + +
    + +
    +
    +
    +
    +
    diff --git a/CC98.Software/src/CC98.Software/Views/Home/Search.cshtml b/CC98.Software/src/CC98.Software/Views/Home/Search.cshtml index 666ab6b..4b49ba7 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/Search.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/Search.cshtml @@ -1,3 +1,6 @@ -@model Software[] +@model Sakura.AspNetCore.IPagedList + @Html.Partial("List", Model); + + diff --git a/CC98.Software/src/CC98.Software/Views/Shared/Components/FrequentSoftwares/Default.cshtml b/CC98.Software/src/CC98.Software/Views/Shared/Components/FrequentSoftwares/Default.cshtml index c6920c1..c78220f 100644 --- a/CC98.Software/src/CC98.Software/Views/Shared/Components/FrequentSoftwares/Default.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Shared/Components/FrequentSoftwares/Default.cshtml @@ -1,6 +1,6 @@ @model Software[] -@foreach (Software i in Model) +@foreach (var i in Model) { @i.Name } \ No newline at end of file diff --git a/CC98.Software/src/CC98.Software/Views/Shared/Components/HotSoftwares/Default.cshtml b/CC98.Software/src/CC98.Software/Views/Shared/Components/HotSoftwares/Default.cshtml index aa99166..2c74a04 100644 --- a/CC98.Software/src/CC98.Software/Views/Shared/Components/HotSoftwares/Default.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Shared/Components/HotSoftwares/Default.cshtml @@ -1,6 +1,6 @@ @model Software[] - @foreach(Software i in Model) + @foreach(var i in Model) { @i.Name } diff --git a/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml b/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml index 4e56356..7b0317b 100644 --- a/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml @@ -37,10 +37,10 @@ {
  • 后台管理
  • } -
  • 信箱
  • +
  • 信箱
  • -
    +
    diff --git a/CC98.Software/src/CC98.Software/Views/_ViewImports.cshtml b/CC98.Software/src/CC98.Software/Views/_ViewImports.cshtml index 14e276b..d7d405d 100644 --- a/CC98.Software/src/CC98.Software/Views/_ViewImports.cshtml +++ b/CC98.Software/src/CC98.Software/Views/_ViewImports.cshtml @@ -2,4 +2,5 @@ @using CC98.Software.Data @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@addTagHelper *, Sakura.AspNetCore.Mvc.PagedList @addTagHelper *, CC98.Software \ No newline at end of file From 2cc875771cf6a0e085207ab1549a846302351758 Mon Sep 17 00:00:00 2001 From: MoLan1980 <775026348@qq.com> Date: Sun, 7 May 2017 00:14:25 +0800 Subject: [PATCH 35/38] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/Home/ShowUpload.cshtml | 63 +++++++++++++++---- .../CC98.Software/Views/Shared/_Layout.cshtml | 2 +- 2 files changed, 51 insertions(+), 14 deletions(-) diff --git a/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml b/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml index 0dbabfd..f3e24c4 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml @@ -9,16 +9,53 @@ (1.软件名称2.软件图标3.软件分类4.软件适用平台5.软件功能简介6.安装说明7.文件的ftp地址 2.http上传模式 除了以上表单内容除第七项以外,新增上传界面(推荐小文件上传)*/ } -
    - 上传文件
    -
    - 上传软件图标
    -
    - 软件名称
    - 软件介绍
    - 软件适用平台Windows - Mac - Android - Ios
    -
    -
    \ No newline at end of file +
    +
    +
    +
    + + +
    + + 浏览 +
    +
    +
    + + +
    + + 浏览 +
    +
    + +
    + +
    +
    +
    + + + +
    +
    + + Windows + Mac + Android + Ios +
    +
    +
    +
    +
    +
    + \ No newline at end of file diff --git a/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml b/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml index 7b0317b..9b45d05 100644 --- a/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Shared/_Layout.cshtml @@ -46,7 +46,7 @@
  • 登录
  • -
  • 注销
  • +
  • 注销
  • From 3a80c3cba77c998b15f154d879c0d4b34a4c2034 Mon Sep 17 00:00:00 2001 From: MoLan1980 <775026348@qq.com> Date: Wed, 10 May 2017 00:10:58 +0800 Subject: [PATCH 36/38] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E4=BC=98=E5=8C=961.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml | 1 + 1 file changed, 1 insertion(+) diff --git a/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml b/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml index f3e24c4..80fd78c 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml @@ -10,6 +10,7 @@ 2.http上传模式 除了以上表单内容除第七项以外,新增上传界面(推荐小文件上传)*/ }
    +

    上传软件


    From 07f8453e9b48731665ddae3243e00a67499e5681 Mon Sep 17 00:00:00 2001 From: MoLan1980 <775026348@qq.com> Date: Tue, 23 May 2017 03:42:22 +0800 Subject: [PATCH 37/38] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=95=8C=E9=9D=A2=20?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E9=80=89=E6=8B=A9=E6=96=87=E4=BB=B6=E5=90=8E?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=A1=86=E5=86=85=E6=97=A0=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/Home/ShowUpload.cshtml | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml b/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml index 80fd78c..b279652 100644 --- a/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml +++ b/CC98.Software/src/CC98.Software/Views/Home/ShowUpload.cshtml @@ -51,12 +51,19 @@
    - \ No newline at end of file + $('input[id=lefile]').change(function() { + $('#photoCover').val( getFileName($('#lefile').val())); + }); + $('input[id=lepic]').change(function () { + $('#photoCover2').val( getFileName($('#lepic').val())); + }); + function getFileName(o) { + var pos = o.lastIndexOf("\\"); + return o.substring(pos + 1); + } + + +} \ No newline at end of file From 3487198c6a1f98fcf3452977bf9c4c55f92e26ab Mon Sep 17 00:00:00 2001 From: Vayne Tian Date: Tue, 3 Apr 2018 01:19:23 +0800 Subject: [PATCH 38/38] =?UTF-8?q?=E6=8C=96=E5=9D=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..6e7b514 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# CC98软件站 + +CC98-2016级技术组的第一个也是最后一个项目(2017.1-2017.6),最后由于人员流失以及没有前端还有其他种种原因,在后端初步成型未经测试的情况下终结。 + +Dearkano +4/3/2018