Формы. Фикс отображения валют в кредитной программе. Фикс отображения имени оператора.
This commit is contained in:
parent
e60309c7dd
commit
98e1450a2b
@ -47,7 +47,6 @@ namespace BankBusinessLogic.BusinessLogics
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}. Login: { Login}", element.Id);
|
||||
return element;
|
||||
}
|
||||
public bool Create(BankOperatorBindingModel model)
|
||||
|
@ -35,6 +35,7 @@ namespace BankDatabaseImplement.Implements
|
||||
}
|
||||
using var context = new BankDatabase();
|
||||
return context.CreditPrograms.Include(x => x.BankOperator)
|
||||
.Include(x => x.Currencies).ThenInclude(x => x.Currency)
|
||||
.FirstOrDefault(x => x.Id == model.Id)
|
||||
?.GetViewModel;
|
||||
}
|
||||
@ -49,6 +50,7 @@ namespace BankDatabaseImplement.Implements
|
||||
{
|
||||
using var context = new BankDatabase();
|
||||
return context.CreditPrograms.Include(x => x.BankOperator)
|
||||
.Include(x => x.Currencies).ThenInclude(x => x.Currency)
|
||||
.Where(x => x.BankOperatorId == model.BankOperatorId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
@ -57,6 +59,7 @@ namespace BankDatabaseImplement.Implements
|
||||
{
|
||||
using var context = new BankDatabase();
|
||||
return context.CreditPrograms.Include(x => x.BankOperator)
|
||||
.Include(x => x.Currencies).ThenInclude(x => x.Currency)
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
@ -67,6 +70,7 @@ namespace BankDatabaseImplement.Implements
|
||||
{
|
||||
using var context = new BankDatabase();
|
||||
return context.CreditPrograms.Include(x => x.BankOperator)
|
||||
.Include(x => x.Currencies).ThenInclude(x => x.Currency)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
485
Bank/BankDatabaseImplement/Migrations/20230519211435_FixCurrencyAndCreditProgramRelation.Designer.cs
generated
Normal file
485
Bank/BankDatabaseImplement/Migrations/20230519211435_FixCurrencyAndCreditProgramRelation.Designer.cs
generated
Normal file
@ -0,0 +1,485 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using BankDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BankDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(BankDatabase))]
|
||||
[Migration("20230519211435_FixCurrencyAndCreditProgramRelation")]
|
||||
partial class FixCurrencyAndCreditProgramRelation
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.5")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.BankOperator", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("MiddleName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("BankOperators");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgram", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BankOperatorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<float>("Percent")
|
||||
.HasColumnType("real");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BankOperatorId");
|
||||
|
||||
b.ToTable("CreditPrograms");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgramCurrency", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CreditProgramId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CurrencyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreditProgramId");
|
||||
|
||||
b.HasIndex("CurrencyId");
|
||||
|
||||
b.ToTable("CreditProgramCurrencies");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Currency", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BankOperatorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BankOperatorId");
|
||||
|
||||
b.ToTable("Currencies");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.CurrencyPayment", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CurrencyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PaymentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CurrencyId");
|
||||
|
||||
b.HasIndex("PaymentId");
|
||||
|
||||
b.ToTable("CurrencyPayments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.CurrencyPurchase", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<float>("Amount")
|
||||
.HasColumnType("real");
|
||||
|
||||
b.Property<int>("BankOperatorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CurrencyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("PurchaseDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BankOperatorId");
|
||||
|
||||
b.HasIndex("CurrencyId");
|
||||
|
||||
b.ToTable("CurrencyPurchases");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("CreditProgramId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DealDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("OperatorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreditProgramId");
|
||||
|
||||
b.HasIndex("OperatorId");
|
||||
|
||||
b.ToTable("Deals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.DealPayment", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("DealId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PaymentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DealId");
|
||||
|
||||
b.HasIndex("PaymentId");
|
||||
|
||||
b.ToTable("DealPayments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Operator", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Login")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("MiddleName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Operators");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Payment", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("OperatorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("PaymentDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OperatorId");
|
||||
|
||||
b.ToTable("Payments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Transfer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<float>("Amount")
|
||||
.HasColumnType("real");
|
||||
|
||||
b.Property<int>("OperatorId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PaymentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("TransferDateTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OperatorId");
|
||||
|
||||
b.HasIndex("PaymentId");
|
||||
|
||||
b.ToTable("Transfers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgram", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.BankOperator", "BankOperator")
|
||||
.WithMany()
|
||||
.HasForeignKey("BankOperatorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("BankOperator");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgramCurrency", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.CreditProgram", "CreditProgram")
|
||||
.WithMany("Currencies")
|
||||
.HasForeignKey("CreditProgramId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.Currency", "Currency")
|
||||
.WithMany("CreditProgramCurrency")
|
||||
.HasForeignKey("CurrencyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CreditProgram");
|
||||
|
||||
b.Navigation("Currency");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Currency", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.BankOperator", "BankOperator")
|
||||
.WithMany()
|
||||
.HasForeignKey("BankOperatorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("BankOperator");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.CurrencyPayment", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.Currency", "Currency")
|
||||
.WithMany()
|
||||
.HasForeignKey("CurrencyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.Payment", "Payment")
|
||||
.WithMany("Currencies")
|
||||
.HasForeignKey("PaymentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Currency");
|
||||
|
||||
b.Navigation("Payment");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.CurrencyPurchase", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.BankOperator", "BankOperator")
|
||||
.WithMany()
|
||||
.HasForeignKey("BankOperatorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.Currency", "Currency")
|
||||
.WithMany()
|
||||
.HasForeignKey("CurrencyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("BankOperator");
|
||||
|
||||
b.Navigation("Currency");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.CreditProgram", "CreditProgram")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreditProgramId");
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.Operator", "Operator")
|
||||
.WithMany()
|
||||
.HasForeignKey("OperatorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CreditProgram");
|
||||
|
||||
b.Navigation("Operator");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.DealPayment", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.Deal", "Deal")
|
||||
.WithMany("DealPayments")
|
||||
.HasForeignKey("DealId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.Payment", "Payment")
|
||||
.WithMany("Deals")
|
||||
.HasForeignKey("PaymentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Deal");
|
||||
|
||||
b.Navigation("Payment");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Payment", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.Operator", "Operator")
|
||||
.WithMany()
|
||||
.HasForeignKey("OperatorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Operator");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Transfer", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.Operator", "Operator")
|
||||
.WithMany()
|
||||
.HasForeignKey("OperatorId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.Payment", "Payment")
|
||||
.WithMany()
|
||||
.HasForeignKey("PaymentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Operator");
|
||||
|
||||
b.Navigation("Payment");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgram", b =>
|
||||
{
|
||||
b.Navigation("Currencies");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Currency", b =>
|
||||
{
|
||||
b.Navigation("CreditProgramCurrency");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.Navigation("DealPayments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Payment", b =>
|
||||
{
|
||||
b.Navigation("Currencies");
|
||||
|
||||
b.Navigation("Deals");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BankDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class FixCurrencyAndCreditProgramRelation : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@ namespace BankDatabaseImplement.Migrations
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.4")
|
||||
.HasAnnotation("ProductVersion", "7.0.5")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
@ -330,7 +330,7 @@ namespace BankDatabaseImplement.Migrations
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.Currency", "Currency")
|
||||
.WithMany()
|
||||
.WithMany("CreditProgramCurrency")
|
||||
.HasForeignKey("CurrencyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
@ -460,6 +460,11 @@ namespace BankDatabaseImplement.Migrations
|
||||
b.Navigation("Currencies");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Currency", b =>
|
||||
{
|
||||
b.Navigation("CreditProgramCurrency");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Deal", b =>
|
||||
{
|
||||
b.Navigation("DealPayments");
|
||||
|
@ -68,6 +68,9 @@ namespace BankDatabaseImplement.Models
|
||||
public CreditProgramViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
BankOperatorFIO = BankOperator.LastName + " "
|
||||
+ BankOperator.FirstName + " "
|
||||
+ BankOperator.MiddleName,
|
||||
Name = Name,
|
||||
Percent = Percent,
|
||||
CreditProgramCurrencies = CreditProgramCurrencies,
|
||||
|
@ -18,6 +18,8 @@ namespace BankDatabaseImplement.Models
|
||||
public string Name { get; set; }
|
||||
public int BankOperatorId { get; set; }
|
||||
public virtual BankOperator BankOperator { get; set; } = new();
|
||||
[ForeignKey("CurrencyId")]
|
||||
public virtual List<CreditProgramCurrency> CreditProgramCurrency { get; set; } = new();
|
||||
public static Currency? Create(BankDatabase context, CurrencyBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
@ -56,6 +58,9 @@ namespace BankDatabaseImplement.Models
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
BankOperatorName = BankOperator.LastName + " "
|
||||
+ BankOperator.FirstName + " "
|
||||
+ BankOperator.MiddleName,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -7,11 +7,18 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.5">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BankBusinessLogic\BankBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\BankContracts\BankContracts.csproj" />
|
||||
<ProjectReference Include="..\BankDatabaseImplement\BankDatabaseImplement.csproj" />
|
||||
<ProjectReference Include="..\BankDataModels\BankDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -6,6 +6,7 @@ using System.Diagnostics;
|
||||
using BankContracts.BusinessLogicsContracts;
|
||||
using BankContracts.SearchModels;
|
||||
using BankDataModels.Models;
|
||||
using BankBusinessLogic.BusinessLogics;
|
||||
|
||||
namespace BankOperatorApp.Controllers
|
||||
{
|
||||
@ -56,12 +57,11 @@ namespace BankOperatorApp.Controllers
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password)
|
||||
|| string.IsNullOrEmpty(lastname) || string.IsNullOrEmpty(firstname) || string.IsNullOrEmpty(middleName))
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(lastname) || string.IsNullOrEmpty(firstname) || string.IsNullOrEmpty(middleName))
|
||||
{
|
||||
throw new Exception("Введите логин, пароль и ФИО");
|
||||
}
|
||||
APIClient.PostRequest("api/bankoperator/updatebankoperator", new OperatorBindingModel
|
||||
_bankOperatorLogic.Update(new BankOperatorBindingModel
|
||||
{
|
||||
Id = APIClient.BankOperator.Id,
|
||||
LastName = lastname,
|
||||
@ -99,9 +99,8 @@ namespace BankOperatorApp.Controllers
|
||||
{
|
||||
throw new Exception("Введите логин и пароль");
|
||||
}
|
||||
APIClient.BankOperator = APIClient.
|
||||
GetRequest<BankOperatorViewModel>
|
||||
($"api/bankoperator/login?login={login}&password={password}");
|
||||
APIClient.BankOperator = _bankOperatorLogic.ReadElement
|
||||
(new BankOperatorSearchModel { Login = login, Password = password });
|
||||
if (APIClient.BankOperator == null)
|
||||
{
|
||||
throw new Exception("Неверный логин/пароль");
|
||||
@ -125,7 +124,7 @@ namespace BankOperatorApp.Controllers
|
||||
{
|
||||
throw new Exception("Введите логин, пароль и ФИО");
|
||||
}
|
||||
APIClient.PostRequest("api/bankoperator/createbankoperator", new BankOperatorBindingModel
|
||||
_bankOperatorLogic.Create(new BankOperatorBindingModel
|
||||
{
|
||||
LastName = lastname,
|
||||
FirstName = firstname,
|
||||
@ -149,10 +148,10 @@ namespace BankOperatorApp.Controllers
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
APIClient.PostRequest("api/currency/createcurrency", new CurrencyBindingModel
|
||||
_currencyLogic.Create(new CurrencyBindingModel
|
||||
{
|
||||
BankOperatorId = APIClient.BankOperator.Id,
|
||||
Name = name,
|
||||
BankOperatorId = APIClient.BankOperator.Id,
|
||||
});
|
||||
Response.Redirect("Index");
|
||||
}
|
||||
@ -162,34 +161,32 @@ namespace BankOperatorApp.Controllers
|
||||
{
|
||||
return Redirect("~/Home/Enter");
|
||||
}
|
||||
return View(APIClient.GetRequest
|
||||
<List<PaymentViewModel>>
|
||||
($"api/creditprogram/getcreditprograms?bankoperatorId={APIClient.BankOperator.Id}"));
|
||||
return View(_creditProgramLogic.ReadList(new CreditProgramSearchModel
|
||||
{ BankOperatorId = APIClient.BankOperator.Id}));
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult CreateCreditProgram()
|
||||
{
|
||||
ViewBag.Currencies = APIClient.GetRequest<List<CurrencyViewModel>>
|
||||
("api/currency/getcurrencieslist");
|
||||
ViewBag.Currencies = _currencyLogic.ReadList(null);
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public void CreateCreditProgram(List<int> currenciess)
|
||||
public void CreateCreditProgram(List<int> currencies, string name, float percent)
|
||||
{
|
||||
if (APIClient.BankOperator == null)
|
||||
{
|
||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||
}
|
||||
Dictionary<int, ICurrencyModel> CurrencyCreditPrograms = new();
|
||||
foreach (int id in currenciess)
|
||||
foreach (int id in currencies)
|
||||
{
|
||||
var currency = _currencyLogic.ReadElement(new CurrencySearchModel { Id = id });
|
||||
if (currency != null) CurrencyCreditPrograms.Add(currency.Id, currency);
|
||||
}
|
||||
_creditProgramLogic.Create(new CreditProgramBindingModel { BankOperatorId =
|
||||
APIClient.BankOperator.Id,
|
||||
CreditProgramCurrencies = CurrencyCreditPrograms, });
|
||||
Response.Redirect("Payments");
|
||||
CreditProgramCurrencies = CurrencyCreditPrograms, Name = name, Percent = percent});
|
||||
Response.Redirect("CreditPrograms");
|
||||
}
|
||||
[HttpGet]
|
||||
public IActionResult CreditProgram(int id)
|
||||
|
@ -1,8 +1,32 @@
|
||||
using BankBusinessLogic.BusinessLogics;
|
||||
using BankContracts.BusinessLogicsContracts;
|
||||
using BankContracts.StoragesContracts;
|
||||
using BankDatabaseImplement.Implements;
|
||||
using BankContracts.BindingModels;
|
||||
using BankOperatorApp;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllersWithViews();
|
||||
|
||||
builder.Services.AddTransient<ICurrencyPurchaseStorage, CurrencyPurchaseStorage>();
|
||||
builder.Services.AddTransient<ICurrencyStorage, CurrencyStorage>();
|
||||
builder.Services.AddTransient<ICreditProgramStorage, CreditProgramStorage>();
|
||||
builder.Services.AddTransient<IBankOperatorStorage, BankOperatorStorage>();
|
||||
|
||||
builder.Services.AddTransient<IDealStorage, DealStorage>();
|
||||
builder.Services.AddTransient<ITransferStorage, TransferStorage>();
|
||||
builder.Services.AddTransient<IPaymentStorage, PaymentStorage>();
|
||||
|
||||
|
||||
builder.Services.AddTransient<ICurrencyPurchaseLogic, CurrencyPurchaseLogic>();
|
||||
builder.Services.AddTransient<ICurrencyLogic, CurrencyLogic>();
|
||||
builder.Services.AddTransient<ICreditProgramLogic, CreditProgramLogic>();
|
||||
builder.Services.AddTransient<IBankOperatorLogic, BankOperatorLogic>();
|
||||
|
||||
builder.Services.AddControllersWithViews();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
|
27
Bank/BankOperatorApp/Views/Home/CreateCreditProgram.cshtml
Normal file
27
Bank/BankOperatorApp/Views/Home/CreateCreditProgram.cshtml
Normal file
@ -0,0 +1,27 @@
|
||||
@{
|
||||
ViewData["Title"] = "CreateCreditProgram";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Создание кредитной программы</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-4">Название:</div>
|
||||
<div class="col-8"><input type="text" name="name" id="name" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Процент:</div>
|
||||
<div class="col-8"><input type="text" name="percent" id="percent" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Валюты:</div>
|
||||
<div class="col-8">
|
||||
<select id="currencies" name="currencies" class="form-control"
|
||||
multiple asp-items="@(new SelectList(@ViewBag.Currencies,"Id", "Name"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
|
||||
</div>
|
||||
</form>
|
16
Bank/BankOperatorApp/Views/Home/CreateCurrency.cshtml
Normal file
16
Bank/BankOperatorApp/Views/Home/CreateCurrency.cshtml
Normal file
@ -0,0 +1,16 @@
|
||||
@{
|
||||
ViewData["Title"] = "CreateCurrency";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Создание валюты</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-4">Название:</div>
|
||||
<div class="col-8"><input type="text" name="name" id="name" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,23 @@
|
||||
@{
|
||||
ViewData["Title"] = "CreateCurrencyPurchase";
|
||||
}
|
||||
<div class="text-center">
|
||||
<h2 class="display-4">Создание закупки валют</h2>
|
||||
</div>
|
||||
<form method="post">
|
||||
<div class="row">
|
||||
<div class="col-4">Валюты::</div>
|
||||
<div class="col-8">
|
||||
<select id="currency" name="currency" class="form-control"
|
||||
asp-items="@(new SelectList(@ViewBag.Currencies,"Id", "Name"))"></select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">Сумма:</div>
|
||||
<div class="col-8"><input type="text" name="amount" id="amount" /></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8"></div>
|
||||
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
|
||||
</div>
|
||||
</form>
|
@ -1,5 +1,66 @@
|
||||
@*
|
||||
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
*@
|
||||
@using BankContracts.ViewModels
|
||||
|
||||
@model List<CreditProgramViewModel>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "CreditPrograms";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Кредитные программы</h1>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="text-center">
|
||||
@{
|
||||
if (Model == null)
|
||||
{
|
||||
<h3 class="display-4">Авторизируйтесь</h3>
|
||||
return;
|
||||
}
|
||||
|
||||
<p>
|
||||
<a asp-action="CreateCreditProgram">Создать кредитную программу</a>
|
||||
</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Номер
|
||||
</th>
|
||||
<th>
|
||||
Название программы
|
||||
</th>
|
||||
<th>
|
||||
Процент кредитования
|
||||
</th>
|
||||
<th>
|
||||
ФИО оператора
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Id)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Name)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Percent)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.BankOperatorFIO)
|
||||
</td>
|
||||
<td>
|
||||
<a asp-action="CreditProgram" asp-route-id="@item.Id">Подробнее</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
|
@ -31,9 +31,6 @@
|
||||
<th>
|
||||
Название валюты
|
||||
</th>
|
||||
<th>
|
||||
ФИО оператора
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -46,9 +43,6 @@
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Name)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.BankOperatorName)
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - BankOperatorApp</title>
|
||||
<title>@ViewData["Title"] - Банк "Вы банкрот!" - приложение оператора</title>
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/BankOperatorApp.styles.css" asp-append-version="true" />
|
||||
@ -12,18 +12,30 @@
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">BankOperatorApp</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Оператор</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
|
||||
<ul class="navbar-nav flex-grow-1">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Валюты</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="CreditPrograms">Кредитные программы</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="CurrencyPurchases">Закупкия</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Личные данные</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Enter">Вход</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user