Skip to content

Commit 1ce0a95

Browse files
committed
added PostLike model
1 parent b64042b commit 1ce0a95

27 files changed

+196
-1
lines changed
659 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.

.vs/BlogPlatformWebApp/v17/.suo

20 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.

BlogPlatformWebApp/Data/BlogPlatformWebAppContext.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@ public BlogPlatformWebAppContext (DbContextOptions<BlogPlatformWebAppContext> op
1717
public DbSet<BlogPlatformWebApp.Models.Post> Post { get; set; } = default!;
1818

1919
public DbSet<BlogPlatformWebApp.Models.User> User { get; set; } = default!;
20+
21+
public DbSet<BlogPlatformWebApp.Models.PostLike> PostLike { get; set; } = default!;
2022
}
2123
}

BlogPlatformWebApp/Migrations/20230911055956_PostLikes.Designer.cs

Lines changed: 125 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using Microsoft.EntityFrameworkCore.Migrations;
2+
3+
#nullable disable
4+
5+
namespace BlogPlatformWebApp.Migrations
6+
{
7+
/// <inheritdoc />
8+
public partial class PostLikes : Migration
9+
{
10+
/// <inheritdoc />
11+
protected override void Up(MigrationBuilder migrationBuilder)
12+
{
13+
migrationBuilder.CreateTable(
14+
name: "PostLike",
15+
columns: table => new
16+
{
17+
Id = table.Column<int>(type: "int", nullable: false)
18+
.Annotation("SqlServer:Identity", "1, 1"),
19+
PostId = table.Column<int>(type: "int", nullable: false),
20+
UserId = table.Column<string>(type: "nvarchar(max)", nullable: true)
21+
},
22+
constraints: table =>
23+
{
24+
table.PrimaryKey("PK_PostLike", x => x.Id);
25+
});
26+
}
27+
28+
/// <inheritdoc />
29+
protected override void Down(MigrationBuilder migrationBuilder)
30+
{
31+
migrationBuilder.DropTable(
32+
name: "PostLike");
33+
}
34+
}
35+
}

BlogPlatformWebApp/Migrations/BlogPlatformWebAppContextModelSnapshot.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,25 @@ protected override void BuildModel(ModelBuilder modelBuilder)
5959
b.ToTable("Post");
6060
});
6161

62+
modelBuilder.Entity("BlogPlatformWebApp.Models.PostLike", b =>
63+
{
64+
b.Property<int>("Id")
65+
.ValueGeneratedOnAdd()
66+
.HasColumnType("int");
67+
68+
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
69+
70+
b.Property<int>("PostId")
71+
.HasColumnType("int");
72+
73+
b.Property<string>("UserId")
74+
.HasColumnType("nvarchar(max)");
75+
76+
b.HasKey("Id");
77+
78+
b.ToTable("PostLike");
79+
});
80+
6281
modelBuilder.Entity("BlogPlatformWebApp.Models.User", b =>
6382
{
6483
b.Property<int>("Id")

BlogPlatformWebApp/Models/PostLike.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+

2+
namespace BlogPlatformWebApp.Models
3+
{
4+
public class PostLike
5+
{
6+
public int Id { get; set; }
7+
public int PostId { get; set; }
8+
public string? UserId { get; set; }
9+
}
10+
}

BlogPlatformWebApp/Pages/Posts/Index.cshtml.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ public IndexModel(Data.BlogPlatformWebAppContext context)
3232
[BindProperty(SupportsGet = true)]
3333
public string? PostTopic { get; set; }
3434

35+
// TODO: Like feature
36+
// TODO: Upload picture in profile
37+
// TODO: Comment feature
38+
3539
public async Task OnGetAsync()
3640
{
3741
Username = HttpContext.Session.GetString("username")!;
Binary file not shown.
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6bd2fb4336a455a61092a7e784d88cfb96e610e3
1+
03112e72ced7a6518f05f6cbfcb26057ffc58456
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)