This commit is contained in:
Ismailov_Rovshan 2023-09-06 22:02:39 +04:00
parent c1c2c3a9f4
commit 973dffc3b3
76 changed files with 742 additions and 200 deletions

View File

@ -1,11 +1,11 @@
using ForumDataModels;
using BlogDataModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.BindingModels
namespace BlogContracts.BindingModels
{
public class CategoryBindingModel : ICategoryModel
{

View File

@ -1,11 +1,11 @@
using ForumDataModels;
using BlogDataModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.BindingModels
namespace BlogContracts.BindingModels
{
public class MessageBindingModel : IMessageModel
{

View File

@ -1,11 +1,11 @@
using ForumDataModels;
using BlogDataModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.BindingModels
namespace BlogContracts.BindingModels
{
public class RoleBindingModel : IRoleModel
{

View File

@ -1,11 +1,11 @@
using ForumDataModels;
using BlogDataModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.BindingModels
namespace BlogContracts.BindingModels
{
public class TopicBindingModel : ITopicModel
{

View File

@ -1,11 +1,11 @@
using ForumDataModels;
using BlogDataModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.BindingModels
namespace BlogContracts.BindingModels
{
public class UserBindingModel : IUserModel
{

View File

@ -1,13 +1,13 @@
using ForumContracts.BindingModels;
using ForumContracts.SearchModels;
using ForumContracts.ViewModels;
using BlogContracts.BindingModels;
using BlogContracts.SearchModels;
using BlogContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.BusinessLogicContracts
namespace BlogContracts.BusinessLogicContracts
{
public interface ICategoryLogic
{

View File

@ -1,13 +1,13 @@
using ForumContracts.BindingModels;
using ForumContracts.SearchModels;
using ForumContracts.ViewModels;
using BlogContracts.BindingModels;
using BlogContracts.SearchModels;
using BlogContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.BusinessLogicContracts
namespace BlogContracts.BusinessLogicContracts
{
public interface IMessageLogic
{

View File

@ -1,13 +1,13 @@
using ForumContracts.BindingModels;
using ForumContracts.SearchModels;
using ForumContracts.ViewModels;
using BlogContracts.BindingModels;
using BlogContracts.SearchModels;
using BlogContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.BusinessLogicContracts
namespace BlogContracts.BusinessLogicContracts
{
public interface IRoleLogic
{

View File

@ -1,13 +1,13 @@
using ForumContracts.BindingModels;
using ForumContracts.SearchModels;
using ForumContracts.ViewModels;
using BlogContracts.BindingModels;
using BlogContracts.SearchModels;
using BlogContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.BusinessLogicContracts
namespace BlogContracts.BusinessLogicContracts
{
public interface ITopicLogic
{

View File

@ -1,13 +1,13 @@
using ForumContracts.BindingModels;
using ForumContracts.SearchModels;
using ForumContracts.ViewModels;
using BlogContracts.BindingModels;
using BlogContracts.SearchModels;
using BlogContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.BusinessLogicContracts
namespace BlogContracts.BusinessLogicContracts
{
public interface IUserLogic
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.SearchModels
namespace BlogContracts.SearchModels
{
public class CategorySearchModel
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.SearchModels
namespace BlogContracts.SearchModels
{
public class MessageSearchModel
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.SearchModels
namespace BlogContracts.SearchModels
{
public class RoleSearchModel
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.SearchModels
namespace BlogContracts.SearchModels
{
public class TopicSearchModel
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.SearchModels
namespace BlogContracts.SearchModels
{
public class UserSearchModel
{

View File

@ -1,13 +1,13 @@
using ForumContracts.BindingModels;
using ForumContracts.SearchModels;
using ForumContracts.ViewModels;
using BlogContracts.BindingModels;
using BlogContracts.SearchModels;
using BlogContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.StoragesContracts
namespace BlogContracts.StoragesContracts
{
public interface ICategoryStorage
{

View File

@ -1,13 +1,13 @@
using ForumContracts.BindingModels;
using ForumContracts.SearchModels;
using ForumContracts.ViewModels;
using BlogContracts.BindingModels;
using BlogContracts.SearchModels;
using BlogContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.StoragesContracts
namespace BlogContracts.StoragesContracts
{
public interface IMessageStorage
{

View File

@ -1,13 +1,13 @@
using ForumContracts.BindingModels;
using ForumContracts.SearchModels;
using ForumContracts.ViewModels;
using BlogContracts.BindingModels;
using BlogContracts.SearchModels;
using BlogContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.StoragesContracts
namespace BlogContracts.StoragesContracts
{
public interface IRoleStorage
{

View File

@ -1,13 +1,13 @@
using ForumContracts.BindingModels;
using ForumContracts.SearchModels;
using ForumContracts.ViewModels;
using BlogContracts.BindingModels;
using BlogContracts.SearchModels;
using BlogContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.StoragesContracts
namespace BlogContracts.StoragesContracts
{
public interface ITopicStorage
{

View File

@ -1,13 +1,13 @@
using ForumContracts.BindingModels;
using ForumContracts.SearchModels;
using ForumContracts.ViewModels;
using BlogContracts.BindingModels;
using BlogContracts.SearchModels;
using BlogContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.StoragesContracts
namespace BlogContracts.StoragesContracts
{
public interface IUserStorage
{

View File

@ -1,4 +1,4 @@
using ForumDataModels;
using BlogDataModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -6,7 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.ViewModels
namespace BlogContracts.ViewModels
{
public class CategoryViewModel : ICategoryModel
{

View File

@ -1,4 +1,4 @@
using ForumDataModels;
using BlogDataModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -6,7 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.ViewModels
namespace BlogContracts.ViewModels
{
public class MessageViewModel : IMessageModel
{

View File

@ -1,4 +1,4 @@
using ForumDataModels;
using BlogDataModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -6,7 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.ViewModels
namespace BlogContracts.ViewModels
{
public class RoleViewModel : IRoleModel
{

View File

@ -1,4 +1,4 @@
using ForumDataModels;
using BlogDataModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -6,7 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.ViewModels
namespace BlogContracts.ViewModels
{
public class TopicViewModel : ITopicModel
{

View File

@ -1,4 +1,4 @@
using ForumDataModels;
using BlogDataModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -6,7 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumContracts.ViewModels
namespace BlogContracts.ViewModels
{
public class UserViewModel : IUserModel
{

View File

@ -9,9 +9,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlogContracts", "BlogContra
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BusinessLogic", "BusinessLogic\BusinessLogic.csproj", "{7A56C58F-F558-48D7-92A1-07D02E3B2387}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlogDatabaseImplement", "BlogDatabaseImplement\BlogDatabaseImplement.csproj", "{EFBA4215-0B0B-4302-9465-89C723F9D975}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlogDatabase", "BlogDatabaseImplement\BlogDatabase.csproj", "{EFBA4215-0B0B-4302-9465-89C723F9D975}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlogViewModel", "BlogViewModel\BlogViewModel.csproj", "{584E2CE9-1804-4A16-AA82-EED3F84531AC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlogViewModel", "BlogViewModel\BlogViewModel.csproj", "{584E2CE9-1804-4A16-AA82-EED3F84531AC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumDataModels
namespace BlogDataModels
{
public interface ICategoryModel : IId
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumDataModels
namespace BlogDataModels
{
public interface IId
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumDataModels
namespace BlogDataModels
{
public interface IMessageModel : IId
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumDataModels
namespace BlogDataModels
{
public interface IRoleModel : IId
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumDataModels
namespace BlogDataModels
{
public interface ITopicModel : IId
{

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumDataModels
namespace BlogDataModels
{
public interface IUserModel : IId
{

View File

@ -1,13 +1,12 @@
using Microsoft.EntityFrameworkCore;
using BlogDatabase.Models;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using BlogDatabase.Models;
namespace BlogDatabaseImplement
namespace BlogDatabase
{
public class BlogDatabase : DbContext
{
@ -15,7 +14,7 @@ namespace BlogDatabaseImplement
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=ForumSubd;Username=postgres;Password=postgres");
optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=BlogSubd;Username=postgres;Password=postgres");
}
base.OnConfiguring(optionsBuilder);
}

View File

@ -1,7 +1,7 @@
using ForumContracts.BindingModels;
using ForumContracts.SearchModels;
using ForumContracts.StoragesContracts;
using ForumContracts.ViewModels;
using BlogContracts.BindingModels;
using BlogContracts.SearchModels;
using BlogContracts.StoragesContracts;
using BlogContracts.ViewModels;
using BlogDatabase.Models;
using System;
using System.Collections.Generic;

View File

@ -1,7 +1,7 @@
using ForumContracts.BindingModels;
using ForumContracts.SearchModels;
using ForumContracts.StoragesContracts;
using ForumContracts.ViewModels;
using BlogContracts.BindingModels;
using BlogContracts.SearchModels;
using BlogContracts.StoragesContracts;
using BlogContracts.ViewModels;
using BlogDatabase.Models;
using Microsoft.EntityFrameworkCore;
using System;

View File

@ -1,7 +1,7 @@
using ForumContracts.BindingModels;
using ForumContracts.SearchModels;
using ForumContracts.StoragesContracts;
using ForumContracts.ViewModels;
using BlogContracts.BindingModels;
using BlogContracts.SearchModels;
using BlogContracts.StoragesContracts;
using BlogContracts.ViewModels;
using BlogDatabase.Models;
using System;
using System.Collections.Generic;

View File

@ -1,7 +1,7 @@
using ForumContracts.BindingModels;
using ForumContracts.SearchModels;
using ForumContracts.StoragesContracts;
using ForumContracts.ViewModels;
using BlogContracts.BindingModels;
using BlogContracts.SearchModels;
using BlogContracts.StoragesContracts;
using BlogContracts.ViewModels;
using BlogDatabase.Models;
using Microsoft.EntityFrameworkCore;
using System;

View File

@ -1,7 +1,7 @@
using ForumContracts.BindingModels;
using ForumContracts.SearchModels;
using ForumContracts.StoragesContracts;
using ForumContracts.ViewModels;
using BlogContracts.BindingModels;
using BlogContracts.SearchModels;
using BlogContracts.StoragesContracts;
using BlogContracts.ViewModels;
using BlogDatabase.Models;
using Microsoft.EntityFrameworkCore;
using System;

View File

@ -0,0 +1,196 @@
// <auto-generated />
using System;
using BlogDatabase;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace BlogDatabase.Migrations
{
[DbContext(typeof(BlogDatabase))]
[Migration("20230906180114_mig4")]
partial class mig4
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("BlogDatabase.Models.Category", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<int>("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("Categories");
});
modelBuilder.Entity("BlogDatabase.Models.Message", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<DateTime>("Date")
.HasColumnType("timestamp with time zone");
b.Property<string>("Text")
.IsRequired()
.HasColumnType("text");
b.Property<int>("TopicId")
.HasColumnType("integer");
b.Property<int>("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("TopicId");
b.HasIndex("UserId");
b.ToTable("Messages");
});
modelBuilder.Entity("BlogDatabase.Models.Role", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Roles");
});
modelBuilder.Entity("BlogDatabase.Models.Topic", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("CategoryId")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<int>("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CategoryId");
b.ToTable("Topics");
});
modelBuilder.Entity("BlogDatabase.Models.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Email")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RegistrationDate")
.HasColumnType("timestamp with time zone");
b.Property<int>("RoleId")
.HasColumnType("integer");
b.Property<string>("Username")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("Users");
});
modelBuilder.Entity("BlogDatabase.Models.Message", b =>
{
b.HasOne("BlogDatabase.Models.Topic", "Topic")
.WithMany()
.HasForeignKey("TopicId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BlogDatabase.Models.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Topic");
b.Navigation("User");
});
modelBuilder.Entity("BlogDatabase.Models.Topic", b =>
{
b.HasOne("BlogDatabase.Models.Category", "Category")
.WithMany()
.HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Category");
});
modelBuilder.Entity("BlogDatabase.Models.User", b =>
{
b.HasOne("BlogDatabase.Models.Role", "Role")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Role");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,154 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace BlogDatabase.Migrations
{
/// <inheritdoc />
public partial class mig4 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Categories",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: false),
UserId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Categories", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Roles",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Roles", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Topics",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column<string>(type: "text", nullable: false),
UserId = table.Column<int>(type: "integer", nullable: false),
CategoryId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Topics", x => x.Id);
table.ForeignKey(
name: "FK_Topics_Categories_CategoryId",
column: x => x.CategoryId,
principalTable: "Categories",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Username = table.Column<string>(type: "text", nullable: false),
Email = table.Column<string>(type: "text", nullable: false),
Password = table.Column<string>(type: "text", nullable: false),
RegistrationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
RoleId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
table.ForeignKey(
name: "FK_Users_Roles_RoleId",
column: x => x.RoleId,
principalTable: "Roles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Messages",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Text = table.Column<string>(type: "text", nullable: false),
Date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UserId = table.Column<int>(type: "integer", nullable: false),
TopicId = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Messages", x => x.Id);
table.ForeignKey(
name: "FK_Messages_Topics_TopicId",
column: x => x.TopicId,
principalTable: "Topics",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Messages_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Messages_TopicId",
table: "Messages",
column: "TopicId");
migrationBuilder.CreateIndex(
name: "IX_Messages_UserId",
table: "Messages",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_Topics_CategoryId",
table: "Topics",
column: "CategoryId");
migrationBuilder.CreateIndex(
name: "IX_Users_RoleId",
table: "Users",
column: "RoleId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Messages");
migrationBuilder.DropTable(
name: "Topics");
migrationBuilder.DropTable(
name: "Users");
migrationBuilder.DropTable(
name: "Categories");
migrationBuilder.DropTable(
name: "Roles");
}
}
}

View File

@ -0,0 +1,193 @@
// <auto-generated />
using System;
using BlogDatabase;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace BlogDatabase.Migrations
{
[DbContext(typeof(BlogDatabase))]
partial class BlogDatabaseModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("BlogDatabase.Models.Category", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<int>("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("Categories");
});
modelBuilder.Entity("BlogDatabase.Models.Message", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<DateTime>("Date")
.HasColumnType("timestamp with time zone");
b.Property<string>("Text")
.IsRequired()
.HasColumnType("text");
b.Property<int>("TopicId")
.HasColumnType("integer");
b.Property<int>("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("TopicId");
b.HasIndex("UserId");
b.ToTable("Messages");
});
modelBuilder.Entity("BlogDatabase.Models.Role", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Roles");
});
modelBuilder.Entity("BlogDatabase.Models.Topic", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("CategoryId")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<int>("UserId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CategoryId");
b.ToTable("Topics");
});
modelBuilder.Entity("BlogDatabase.Models.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Email")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("RegistrationDate")
.HasColumnType("timestamp with time zone");
b.Property<int>("RoleId")
.HasColumnType("integer");
b.Property<string>("Username")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("Users");
});
modelBuilder.Entity("BlogDatabase.Models.Message", b =>
{
b.HasOne("BlogDatabase.Models.Topic", "Topic")
.WithMany()
.HasForeignKey("TopicId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BlogDatabase.Models.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Topic");
b.Navigation("User");
});
modelBuilder.Entity("BlogDatabase.Models.Topic", b =>
{
b.HasOne("BlogDatabase.Models.Category", "Category")
.WithMany()
.HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Category");
});
modelBuilder.Entity("BlogDatabase.Models.User", b =>
{
b.HasOne("BlogDatabase.Models.Role", "Role")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Role");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,6 +1,6 @@
using ForumContracts.BindingModels;
using ForumContracts.ViewModels;
using ForumDataModels;
using BlogContracts.BindingModels;
using BlogContracts.ViewModels;
using BlogDataModels;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

View File

@ -1,6 +1,6 @@
using ForumContracts.BindingModels;
using ForumContracts.ViewModels;
using ForumDataModels;
using BlogContracts.BindingModels;
using BlogContracts.ViewModels;
using BlogDataModels;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

View File

@ -1,6 +1,6 @@
using ForumContracts.BindingModels;
using ForumContracts.ViewModels;
using ForumDataModels;
using BlogContracts.BindingModels;
using BlogContracts.ViewModels;
using BlogDataModels;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

View File

@ -1,6 +1,6 @@
using ForumContracts.BindingModels;
using ForumContracts.ViewModels;
using ForumDataModels;
using BlogContracts.BindingModels;
using BlogContracts.ViewModels;
using BlogDataModels;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

View File

@ -1,6 +1,6 @@
using ForumContracts.BindingModels;
using ForumContracts.ViewModels;
using ForumDataModels;
using BlogContracts.BindingModels;
using BlogContracts.ViewModels;
using BlogDataModels;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

View File

@ -18,7 +18,7 @@
<ItemGroup>
<ProjectReference Include="..\BlogContracts\BlogContracts.csproj" />
<ProjectReference Include="..\BlogDatabaseImplement\BlogDatabaseImplement.csproj" />
<ProjectReference Include="..\BlogDatabaseImplement\BlogDatabase.csproj" />
<ProjectReference Include="..\BlogDataModels\BlogDataModels.csproj" />
<ProjectReference Include="..\BusinessLogic\BusinessLogic.csproj" />
</ItemGroup>

View File

@ -1,4 +1,4 @@
namespace Forum
namespace Blog
{
partial class FormAddTopic
{

View File

@ -1,5 +1,5 @@
using ForumContracts.BindingModels;
using ForumContracts.BusinessLogicContracts;
using BlogContracts.BindingModels;
using BlogContracts.BusinessLogicContracts;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -10,7 +10,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Forum
namespace Blog
{
public partial class FormAddTopic : Form
{

View File

@ -1,4 +1,4 @@
namespace Forum
namespace Blog
{
partial class FormAddTopics
{

View File

@ -1,6 +1,6 @@
using ForumContracts.BindingModels;
using ForumContracts.BusinessLogicContracts;
using ForumContracts.SearchModels;
using BlogContracts.BindingModels;
using BlogContracts.BusinessLogicContracts;
using BlogContracts.SearchModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -11,7 +11,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Forum
namespace Blog
{
public partial class FormAddTopics : Form
{

View File

@ -1,4 +1,4 @@
namespace Forum
namespace Blog
{
partial class FormCategories
{

View File

@ -1,5 +1,5 @@
using ForumContracts.BindingModels;
using ForumContracts.BusinessLogicContracts;
using BlogContracts.BindingModels;
using BlogContracts.BusinessLogicContracts;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -10,7 +10,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Forum
namespace Blog
{
public partial class FormCategories : Form
{

View File

@ -1,4 +1,4 @@
namespace Forum
namespace Blog
{
partial class FormCategory
{
@ -9,7 +9,7 @@
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{

View File

@ -1,6 +1,6 @@
using ForumContracts.BindingModels;
using ForumContracts.BusinessLogicContracts;
using ForumContracts.SearchModels;
using BlogContracts.BindingModels;
using BlogContracts.BusinessLogicContracts;
using BlogContracts.SearchModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -11,7 +11,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Forum
namespace Blog
{
public partial class FormCategory : Form
{

View File

@ -1,4 +1,4 @@
namespace Forum
namespace Blog
{
partial class FormCreateMessage
{

View File

@ -1,7 +1,7 @@
using ForumBusinessLogic;
using ForumContracts.BindingModels;
using ForumContracts.BusinessLogicContracts;
using ForumContracts.SearchModels;
using BlogBusinessLogic;
using BlogContracts.BindingModels;
using BlogContracts.BusinessLogicContracts;
using BlogContracts.SearchModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -12,7 +12,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Forum
namespace Blog
{
public partial class FormCreateMessage : Form
{

View File

@ -1,4 +1,4 @@
namespace Forum
namespace Blog
{
partial class FormMain
{

View File

@ -1,9 +1,9 @@
using ForumBusinessLogic;
using ForumContracts.BindingModels;
using ForumContracts.BusinessLogicContracts;
using BlogBusinessLogic;
using BlogContracts.BindingModels;
using BlogContracts.BusinessLogicContracts;
using System.Windows.Forms;
namespace Forum
namespace Blog
{
public partial class FormMain : Form
{

View File

@ -1,4 +1,4 @@
namespace Forum
namespace Blog
{
partial class FormRole
{

View File

@ -1,6 +1,6 @@
using ForumContracts.BindingModels;
using ForumContracts.BusinessLogicContracts;
using ForumContracts.SearchModels;
using BlogContracts.BindingModels;
using BlogContracts.BusinessLogicContracts;
using BlogContracts.SearchModels;
using Microsoft.EntityFrameworkCore.Diagnostics;
using System;
using System.Collections.Generic;
@ -12,7 +12,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Forum
namespace Blog
{
public partial class FormRole : Form
{

View File

@ -1,4 +1,4 @@
namespace Forum
namespace Blog
{
partial class FormRoles
{

View File

@ -1,5 +1,5 @@
using ForumContracts.BindingModels;
using ForumContracts.BusinessLogicContracts;
using BlogContracts.BindingModels;
using BlogContracts.BusinessLogicContracts;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -10,7 +10,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Forum
namespace Blog
{
public partial class FormRoles : Form
{

View File

@ -1,4 +1,4 @@
namespace Forum
namespace Blog
{
partial class FormTests
{

View File

@ -1,4 +1,4 @@
using ForumContracts.BusinessLogicContracts;
using BlogContracts.BusinessLogicContracts;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -9,7 +9,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Forum
namespace Blog
{
public partial class FormTests : Form
{

View File

@ -1,4 +1,4 @@
namespace Forum
namespace Blog
{
partial class FormUser
{

View File

@ -1,6 +1,6 @@
using ForumContracts.BindingModels;
using ForumContracts.BusinessLogicContracts;
using ForumContracts.SearchModels;
using BlogContracts.BindingModels;
using BlogContracts.BusinessLogicContracts;
using BlogContracts.SearchModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -11,7 +11,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Forum
namespace Blog
{
public partial class FormUser : Form
{

View File

@ -1,4 +1,4 @@
namespace Forum
namespace Blog
{
partial class FormUsers
{

View File

@ -1,6 +1,6 @@
using ForumBusinessLogic;
using ForumContracts.BindingModels;
using ForumContracts.BusinessLogicContracts;
using BlogBusinessLogic;
using BlogContracts.BindingModels;
using BlogContracts.BusinessLogicContracts;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -11,7 +11,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Forum
namespace Blog
{
public partial class FormUsers : Form
{

View File

@ -1,11 +1,11 @@
using ForumBusinessLogic;
using ForumContracts.BusinessLogicContracts;
using ForumContracts.StoragesContracts;
using BlogBusinessLogic;
using BlogContracts.BusinessLogicContracts;
using BlogContracts.StoragesContracts;
using BlogDatabase.Implements;
using Microsoft.Extensions.DependencyInjection;
using System;
namespace Forum
namespace Blog
{
internal static class Program
{

View File

@ -1,15 +1,15 @@
using ForumContracts.BindingModels;
using ForumContracts.BusinessLogicContracts;
using ForumContracts.SearchModels;
using ForumContracts.StoragesContracts;
using ForumContracts.ViewModels;
using BlogContracts.BindingModels;
using BlogContracts.BusinessLogicContracts;
using BlogContracts.SearchModels;
using BlogContracts.StoragesContracts;
using BlogContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumBusinessLogic
namespace BlogBusinessLogic
{
public class CategoryLogic : ICategoryLogic
{

View File

@ -1,15 +1,15 @@
using ForumContracts.BindingModels;
using ForumContracts.BusinessLogicContracts;
using ForumContracts.SearchModels;
using ForumContracts.StoragesContracts;
using ForumContracts.ViewModels;
using BlogContracts.BindingModels;
using BlogContracts.BusinessLogicContracts;
using BlogContracts.SearchModels;
using BlogContracts.StoragesContracts;
using BlogContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumBusinessLogic
namespace BlogBusinessLogic
{
public class MessageLogic : IMessageLogic
{

View File

@ -1,15 +1,15 @@
using ForumContracts.BindingModels;
using ForumContracts.BusinessLogicContracts;
using ForumContracts.SearchModels;
using ForumContracts.StoragesContracts;
using ForumContracts.ViewModels;
using BlogContracts.BindingModels;
using BlogContracts.BusinessLogicContracts;
using BlogContracts.SearchModels;
using BlogContracts.StoragesContracts;
using BlogContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumBusinessLogic
namespace BlogBusinessLogic
{
public class RoleLogic : IRoleLogic
{

View File

@ -1,15 +1,15 @@
using ForumContracts.BindingModels;
using ForumContracts.BusinessLogicContracts;
using ForumContracts.SearchModels;
using ForumContracts.StoragesContracts;
using ForumContracts.ViewModels;
using BlogContracts.BindingModels;
using BlogContracts.BusinessLogicContracts;
using BlogContracts.SearchModels;
using BlogContracts.StoragesContracts;
using BlogContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumBusinessLogic
namespace BlogBusinessLogic
{
public class TopicLogic : ITopicLogic
{

View File

@ -1,15 +1,15 @@
using ForumContracts.BindingModels;
using ForumContracts.BusinessLogicContracts;
using ForumContracts.SearchModels;
using ForumContracts.StoragesContracts;
using ForumContracts.ViewModels;
using BlogContracts.BindingModels;
using BlogContracts.BusinessLogicContracts;
using BlogContracts.SearchModels;
using BlogContracts.StoragesContracts;
using BlogContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ForumBusinessLogic
namespace BlogBusinessLogic
{
public class UserLogic : IUserLogic
{