Compare commits
3 Commits
d698afd31b
...
5e5fdc43f3
Author | SHA1 | Date | |
---|---|---|---|
5e5fdc43f3 | |||
|
b00c7e0c03 | ||
|
3458d836cd |
@ -97,11 +97,6 @@ namespace CaseAccountingBusinessLogic.BusinessLogics
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (model.RoleId < 0)
|
||||
{
|
||||
throw new ArgumentNullException("Некорректный идентификатор роли",
|
||||
nameof(model.RoleId));
|
||||
}
|
||||
if (model.Login == string.Empty)
|
||||
{
|
||||
throw new ArgumentNullException("Некорректный ввод логина",
|
||||
|
@ -1,16 +0,0 @@
|
||||
using CaseAccountingDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CaseAccountingContracts.BindingModels
|
||||
{
|
||||
public class RoleBindingModel : IRoleModel
|
||||
{
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using CaseAccountingDataModels.Models;
|
||||
using CaseAccountingDataModels.Enum;
|
||||
using CaseAccountingDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -13,7 +14,7 @@ namespace CaseAccountingContracts.BindingModels
|
||||
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
public int RoleId { get; set; }
|
||||
public Role Role { get; set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
}
|
||||
|
@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CaseAccountingContracts.SearchModels
|
||||
{
|
||||
public class RoleSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using CaseAccountingDataModels.Enum;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -14,6 +15,6 @@ namespace CaseAccountingContracts.SearchModels
|
||||
|
||||
public string? Password { get; set; }
|
||||
|
||||
public int? RoleId { get; set; }
|
||||
public Role? Role { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +0,0 @@
|
||||
using CaseAccountingDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CaseAccountingContracts.ViewModels
|
||||
{
|
||||
public class RoleViewModel : IRoleModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Название роли")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using CaseAccountingDataModels.Models;
|
||||
using CaseAccountingDataModels.Enum;
|
||||
using CaseAccountingDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -16,6 +17,6 @@ namespace CaseAccountingContracts.ViewModels
|
||||
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
public int RoleId { get; set; }
|
||||
public Role Role { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -28,8 +28,6 @@ namespace CaseAccountingDataBaseImplement
|
||||
|
||||
public virtual DbSet<User> Users { set; get; }
|
||||
|
||||
public virtual DbSet<Role> Roles { set; get; }
|
||||
|
||||
public virtual DbSet<Contract> Contracts { set; get; }
|
||||
|
||||
public virtual DbSet<Deal> Deals { set; get; }
|
||||
|
553
CaseAccounting/CaseAccountingDataBaseImplement/Migrations/20230517211913_Sec.Designer.cs
generated
Normal file
553
CaseAccounting/CaseAccountingDataBaseImplement/Migrations/20230517211913_Sec.Designer.cs
generated
Normal file
@ -0,0 +1,553 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using CaseAccountingDataBaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CaseAccountingDataBaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(CaseAccountingDatabase))]
|
||||
[Migration("20230517211913_Sec")]
|
||||
partial class Sec
|
||||
{
|
||||
/// <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("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Annotation")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Applicant")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Defendant")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpecializationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SpecializationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Cases");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseDeal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DealId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("DealId");
|
||||
|
||||
b.ToTable("CaseDeals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseLawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("CaseLawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<decimal>("Coast")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Service")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Contracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", 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>("Responsibilities")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Subject")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Deals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.DealContract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ContractId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("DealId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ContractId");
|
||||
|
||||
b.HasIndex("DealId");
|
||||
|
||||
b.ToTable("DealContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CaseId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Information")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CaseId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Experience")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Patronymic")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SpecializationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SpecializationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.LawyerContract", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ContractId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("LawyerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ContractId");
|
||||
|
||||
b.HasIndex("LawyerId");
|
||||
|
||||
b.ToTable("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", 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.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Specializations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Role")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Specialization", "Specialization")
|
||||
.WithMany("Cases")
|
||||
.HasForeignKey("SpecializationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Cases")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Specialization");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseDeal", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("Deals")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Deal", "Deal")
|
||||
.WithMany("CaseDeals")
|
||||
.HasForeignKey("DealId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("Deal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.CaseLawyer", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("CaseLawyers")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("CaseLawyers")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Contracts")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Deals")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.DealContract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Contract", "Contract")
|
||||
.WithMany("DealContracts")
|
||||
.HasForeignKey("ContractId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Deal", "Deal")
|
||||
.WithMany("Contracts")
|
||||
.HasForeignKey("DealId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Contract");
|
||||
|
||||
b.Navigation("Deal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Hearing", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Case", "Case")
|
||||
.WithMany("Hearings")
|
||||
.HasForeignKey("CaseId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Hearings")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Case");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Specialization", "Specialization")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("SpecializationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Lawyers")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Specialization");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.LawyerContract", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Contract", "Contract")
|
||||
.WithMany("LawyerContracts")
|
||||
.HasForeignKey("ContractId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Lawyer", "Lawyer")
|
||||
.WithMany("LawyerContracts")
|
||||
.HasForeignKey("LawyerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Contract");
|
||||
|
||||
b.Navigation("Lawyer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.User", "User")
|
||||
.WithMany("Specializations")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Navigation("CaseLawyers");
|
||||
|
||||
b.Navigation("Deals");
|
||||
|
||||
b.Navigation("Hearings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Contract", b =>
|
||||
{
|
||||
b.Navigation("DealContracts");
|
||||
|
||||
b.Navigation("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.Navigation("CaseDeals");
|
||||
|
||||
b.Navigation("Contracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Lawyer", b =>
|
||||
{
|
||||
b.Navigation("CaseLawyers");
|
||||
|
||||
b.Navigation("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.Navigation("Cases");
|
||||
|
||||
b.Navigation("Lawyers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.User", b =>
|
||||
{
|
||||
b.Navigation("Cases");
|
||||
|
||||
b.Navigation("Contracts");
|
||||
|
||||
b.Navigation("Deals");
|
||||
|
||||
b.Navigation("Hearings");
|
||||
|
||||
b.Navigation("Lawyers");
|
||||
|
||||
b.Navigation("Specializations");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CaseAccountingDataBaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Sec : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Users_Roles_RoleId",
|
||||
table: "Users");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Roles");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Users_RoleId",
|
||||
table: "Users");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "RoleId",
|
||||
table: "Users",
|
||||
newName: "Role");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "Role",
|
||||
table: "Users",
|
||||
newName: "RoleId");
|
||||
|
||||
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.CreateIndex(
|
||||
name: "IX_Users_RoleId",
|
||||
table: "Users",
|
||||
column: "RoleId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Users_Roles_RoleId",
|
||||
table: "Users",
|
||||
column: "RoleId",
|
||||
principalTable: "Roles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
@ -281,23 +281,6 @@ namespace CaseAccountingDataBaseImplement.Migrations
|
||||
b.ToTable("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.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("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@ -336,13 +319,11 @@ namespace CaseAccountingDataBaseImplement.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("RoleId")
|
||||
b.Property<int>("Role")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
@ -512,17 +493,6 @@ namespace CaseAccountingDataBaseImplement.Migrations
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.User", b =>
|
||||
{
|
||||
b.HasOne("CaseAccountingDataBaseImplement.Models.Role", "Role")
|
||||
.WithMany("Users")
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Role");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Case", b =>
|
||||
{
|
||||
b.Navigation("CaseLawyers");
|
||||
@ -553,11 +523,6 @@ namespace CaseAccountingDataBaseImplement.Migrations
|
||||
b.Navigation("LawyerContracts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Role", b =>
|
||||
{
|
||||
b.Navigation("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("CaseAccountingDataBaseImplement.Models.Specialization", b =>
|
||||
{
|
||||
b.Navigation("Cases");
|
||||
|
@ -1,53 +0,0 @@
|
||||
using CaseAccountingContracts.BindingModels;
|
||||
using CaseAccountingContracts.ViewModels;
|
||||
using CaseAccountingDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks.Dataflow;
|
||||
|
||||
namespace CaseAccountingDataBaseImplement.Models
|
||||
{
|
||||
public class Role : IRoleModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[ForeignKey("RoleId")]
|
||||
public virtual List<User> Users { get; set; } = new();
|
||||
|
||||
public static Role? Create(RoleBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Role()
|
||||
{
|
||||
Id = model.Id,
|
||||
Name = model.Name,
|
||||
};
|
||||
}
|
||||
public void Update(RoleBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Name = model.Name;
|
||||
}
|
||||
|
||||
public RoleViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
};
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using CaseAccountingContracts.BindingModels;
|
||||
using CaseAccountingContracts.ViewModels;
|
||||
using CaseAccountingDataModels.Enum;
|
||||
using CaseAccountingDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -22,8 +23,7 @@ namespace CaseAccountingDataBaseImplement.Models
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
public int RoleId { get; set; }
|
||||
public virtual Role Role { get; set; } = new();
|
||||
public Role Role { get; set; }
|
||||
|
||||
[ForeignKey("UserId")]
|
||||
public virtual List<Hearing> Hearings { get; set; } = new();
|
||||
@ -54,7 +54,7 @@ namespace CaseAccountingDataBaseImplement.Models
|
||||
Id = model.Id,
|
||||
Login = model.Login,
|
||||
Password = model.Password,
|
||||
RoleId = model.RoleId
|
||||
Role = model.Role
|
||||
};
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ namespace CaseAccountingDataBaseImplement.Models
|
||||
Id = Id,
|
||||
Login = Login,
|
||||
Password = Password,
|
||||
RoleId = RoleId,
|
||||
Role = Role,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,11 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CaseAccountingDataModels.Models
|
||||
namespace CaseAccountingDataModels.Enum
|
||||
{
|
||||
public interface IRoleModel : IId
|
||||
public enum Role
|
||||
{
|
||||
string Name { get; }
|
||||
Provider = 0,
|
||||
Customer = 1
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using CaseAccountingDataModels.Enum;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -10,6 +11,6 @@ namespace CaseAccountingDataModels.Models
|
||||
{
|
||||
string Login { get; }
|
||||
string Password { get; }
|
||||
int RoleId { get; }
|
||||
Role Role { get; }
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ namespace CaseAccountingRestApi.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
return _logic.ReadList(null);
|
||||
return _logic.ReadList(new CaseSearchModel { UserId = userId });
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@ -43,32 +43,6 @@ namespace CaseAccountingRestApi.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
/*[HttpGet]
|
||||
public List<CaseViewModel>? GetMany(int userId, int page)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _logic.ReadList(new CaseSearchModel { UserId = userId, PageNumber = page, PageSize = 10 });
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}*/
|
||||
|
||||
/*[HttpGet]
|
||||
public int GetNumberOfPages(int userId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _studentLogic.GetNumberOfPages(userId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}*/
|
||||
|
||||
[HttpPost]
|
||||
public void Create(CaseBindingModel model)
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ namespace CaseAccountingRestApi.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
return _logic.ReadList(null);
|
||||
return _logic.ReadList(new ContractSearchModel { UserId = userId });
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ namespace CaseAccountingRestApi.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
return _logic.ReadList(null);
|
||||
return _logic.ReadList(new DealSearchModel { UserId = userId });
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ namespace CaseAccountingRestApi.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
return _logic.ReadList(null);
|
||||
return _logic.ReadList(new HearingSearchModel { UserId = userId });
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
@ -3,6 +3,7 @@ using CaseAccountingContracts.BusinessLogicContracts;
|
||||
using CaseAccountingContracts.SearchModels;
|
||||
using CaseAccountingContracts.ViewModels;
|
||||
using CaseAccountingDataBaseImplement.Models;
|
||||
using CaseAccountingDataModels.Enum;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace CaseAccountingRestApi.Controllers
|
||||
@ -27,7 +28,7 @@ namespace CaseAccountingRestApi.Controllers
|
||||
{
|
||||
Login = login,
|
||||
Password = password,
|
||||
//Role = role
|
||||
Role = role
|
||||
});
|
||||
}
|
||||
catch (Exception)
|
||||
|
Loading…
Reference in New Issue
Block a user