в контрактах осталось доделать логику отчетов, обговорить модели, а точнее ссылки
This commit is contained in:
parent
045c185766
commit
a990daaf95
@ -10,4 +10,11 @@
|
||||
<ProjectReference Include="..\BankDataModels\BankDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="ViewModels\Cashier\Diagram\" />
|
||||
<Folder Include="ViewModels\Cashier\Reports\" />
|
||||
<Folder Include="ViewModels\Client\Diagram\" />
|
||||
<Folder Include="ViewModels\Client\Reports\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -1,6 +1,6 @@
|
||||
using BankContracts.BindingModels;
|
||||
using BankContracts.SearchModels;
|
||||
using BankContracts.ViewModels;
|
||||
using BankContracts.ViewModels.Client.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace BankContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface ICardLogic
|
||||
public interface ICardLogic
|
||||
{
|
||||
List<CardViewModel>? ReadList(CardSearchModel? model);
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
using BankContracts.BindingModels;
|
||||
using BankContracts.SearchModels;
|
||||
using BankContracts.ViewModels.Cashier.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -1,6 +1,6 @@
|
||||
using BankContracts.BindingModels;
|
||||
using BankContracts.SearchModels;
|
||||
using BankContracts.ViewModels;
|
||||
using BankContracts.ViewModels.Cashier.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace BankContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface ICashierLogic
|
||||
public interface ICashierLogic
|
||||
{
|
||||
List<CashierViewModel>? ReadList(CashierSearchModel? model);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
using BankContracts.BindingModels;
|
||||
using BankContracts.SearchModels;
|
||||
using BankContracts.ViewModels;
|
||||
using BankContracts.ViewModels.Client.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace BankContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IClientLogic
|
||||
public interface IClientLogic
|
||||
{
|
||||
List<ClientViewModel>? ReadList(ClientSearchModel? model);
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
using BankContracts.BindingModels;
|
||||
using BankContracts.SearchModels;
|
||||
using BankContracts.ViewModels.Client.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -1,4 +1,6 @@
|
||||
using BankContracts.SearchModels;
|
||||
using BankContracts.BindingModels;
|
||||
using BankContracts.SearchModels;
|
||||
using BankContracts.ViewModels.Client.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -1,5 +1,6 @@
|
||||
using BankContracts.BindingModels;
|
||||
using BankContracts.SearchModels;
|
||||
using BankContracts.ViewModels.Cashier.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -1,6 +1,6 @@
|
||||
using BankContracts.BindingModels;
|
||||
using BankContracts.SearchModels;
|
||||
using BankContracts.ViewModels;
|
||||
using BankContracts.ViewModels.Client.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -9,8 +9,8 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace BankContracts.StoragesModels
|
||||
{
|
||||
// Интерфейс для хранилища банковских карт
|
||||
public interface ICardStorage
|
||||
// Интерфейс для хранилища банковских карт
|
||||
public interface ICardStorage
|
||||
{
|
||||
List<CardViewModel> GetFullList();
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
using BankContracts.BindingModels;
|
||||
using BankContracts.SearchModels;
|
||||
using BankContracts.ViewModels.Cashier.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -1,6 +1,6 @@
|
||||
using BankContracts.BindingModels;
|
||||
using BankContracts.SearchModels;
|
||||
using BankContracts.ViewModels;
|
||||
using BankContracts.ViewModels.Cashier.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -9,8 +9,8 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace BankContracts.StoragesModels
|
||||
{
|
||||
// Интерфейс для хранилища кассиров
|
||||
public interface ICashierStorage
|
||||
// Интерфейс для хранилища кассиров
|
||||
public interface ICashierStorage
|
||||
{
|
||||
List<CashierViewModel> GetFullList();
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
using BankContracts.BindingModels;
|
||||
using BankContracts.SearchModels;
|
||||
using BankContracts.ViewModels;
|
||||
using BankContracts.ViewModels.Client.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -9,8 +9,8 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace BankContracts.StoragesModels
|
||||
{
|
||||
// Интерфейс для хранилища клиентов
|
||||
public interface IClientStorage
|
||||
// Интерфейс для хранилища клиентов
|
||||
public interface IClientStorage
|
||||
{
|
||||
List<ClientViewModel> GetFullList();
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
using BankContracts.SearchModels;
|
||||
using BankContracts.BindingModels;
|
||||
using BankContracts.SearchModels;
|
||||
using BankContracts.ViewModels.Client.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -1,4 +1,6 @@
|
||||
using BankContracts.SearchModels;
|
||||
using BankContracts.BindingModels;
|
||||
using BankContracts.SearchModels;
|
||||
using BankContracts.ViewModels.Client.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -1,4 +1,6 @@
|
||||
using BankContracts.SearchModels;
|
||||
using BankContracts.BindingModels;
|
||||
using BankContracts.SearchModels;
|
||||
using BankContracts.ViewModels.Cashier.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -1,36 +0,0 @@
|
||||
using BankDataModels.Enums;
|
||||
using BankDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankContracts.ViewModels
|
||||
{
|
||||
public class CardViewModel : ICardModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int ClientId { get; set; }
|
||||
|
||||
public int AccountId { get; set; }
|
||||
|
||||
// Номер банковской карты
|
||||
[DisplayName("Номер карты")]
|
||||
public string Number { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Баланс карты")]
|
||||
public double Balance { get; set; }
|
||||
|
||||
[DisplayName("Срок действия")]
|
||||
public DateTime Period { get; set; } = DateTime.Now;
|
||||
|
||||
[DisplayName("Статус карты")]
|
||||
public StatusCard StatusCard { get; set; } = StatusCard.Закрыта;
|
||||
|
||||
[DisplayName("Фамилия клиента")]
|
||||
public string? ClientSurname { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
using BankDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankContracts.ViewModels.Cashier.ViewModels
|
||||
{
|
||||
public class CashWithdrawalViewModel : ICashWithdrawalModel
|
||||
{
|
||||
//вот тут вопрос, смотри можно сделать номер операции айдишником
|
||||
//то есть просто сделать так , думаю это будет правильно
|
||||
//[DisplayName("Номер операции")]
|
||||
public int Id { get; set; }
|
||||
public int DebitingId { get; set; }
|
||||
|
||||
//public int AccountId { get; set; }
|
||||
|
||||
// тут тоже вопрос, у нас операции не связаны ни со счетом ни с картами, поэтому это стоит обсудить
|
||||
//[DisplayName("Номер счёта")]
|
||||
//public string AccountNumber { get; set; } = string.Empty;
|
||||
|
||||
//для более правильной логики наверное надо
|
||||
//[DisplayName("Кассир")]
|
||||
//public string SurmaneCashier { get; set; } = string.Empty;
|
||||
public int CashierId { get; set; }
|
||||
|
||||
[DisplayName("Сумма выданных наличных")]
|
||||
public double Sum { get; set; }
|
||||
|
||||
[DisplayName("Дата операции")]
|
||||
public DateTime DateWithdrawal { get; set; } = DateTime.Now;
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
using BankDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankContracts.ViewModels.Cashier.ViewModels
|
||||
{
|
||||
public class CashierViewModel : ICashierModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Имя")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Фамилия")]
|
||||
public string Surname { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Отчество")]
|
||||
public string Patronymic { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Почта")]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Пароль")]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Телефон")]
|
||||
public string MobilePhone { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankContracts.ViewModels
|
||||
namespace BankContracts.ViewModels.Cashier.ViewModels
|
||||
{
|
||||
public class MoneyTransferViewModel : IMoneyTransferModel
|
||||
{
|
@ -1,33 +0,0 @@
|
||||
using BankDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankContracts.ViewModels
|
||||
{
|
||||
public class CashierViewModel : ICashierModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Имя")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Фамилия")]
|
||||
public string Surname { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Отчество")]
|
||||
public string Patronymic { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Почта")]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Пароль")]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Телефон")]
|
||||
public string MobilePhone { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
using BankDataModels.Enums;
|
||||
using BankDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankContracts.ViewModels.Client.ViewModels
|
||||
{
|
||||
public class CardViewModel : ICardModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int ClientId { get; set; }
|
||||
|
||||
public int AccountId { get; set; }
|
||||
|
||||
// Номер банковской карты
|
||||
[DisplayName("Номер карты")]
|
||||
public string Number { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Баланс карты")]
|
||||
public double Balance { get; set; }
|
||||
|
||||
[DisplayName("Срок действия")]
|
||||
public DateTime Period { get; set; } = DateTime.Now;
|
||||
|
||||
[DisplayName("Статус карты")]
|
||||
public StatusCard StatusCard { get; set; } = StatusCard.Закрыта;
|
||||
|
||||
[DisplayName("Фамилия клиента")]
|
||||
public string? ClientSurname { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
using BankDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankContracts.ViewModels.Client.ViewModels
|
||||
{
|
||||
public class ClientViewModel : IClientModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Имя")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Фамилия")]
|
||||
public string Surname { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Отчество")]
|
||||
public string Patronymic { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Почта")]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Пароль")]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Телефон")]
|
||||
public string MobilePhone { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
using BankDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankContracts.ViewModels.Client.ViewModels
|
||||
{
|
||||
public class CreditingViewModel : ICreditingModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int ClientId { get; set; }
|
||||
|
||||
[DisplayName("Сумма операции")]
|
||||
public double Sum { get; set; }
|
||||
|
||||
[DisplayName("Дата заявки")]
|
||||
public DateTime DateCredit { get; set; } = DateTime.Now;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
using BankDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankContracts.ViewModels.Client.ViewModels
|
||||
{
|
||||
public class DebitingViewModel : IDebitingModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int ClientId { get; set; }
|
||||
|
||||
[DisplayName("Сумма операции")]
|
||||
public double Sum { get; set; }
|
||||
|
||||
[DisplayName("Дата открытия заявки")]
|
||||
public DateTime DateDebit { get; set; } = DateTime.Now;
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
using BankDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankContracts.ViewModels
|
||||
{
|
||||
public class ClientViewModel : IClientModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Имя")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Фамилия")]
|
||||
public string Surname { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Отчество")]
|
||||
public string Patronymic { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Почта")]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Пароль")]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Телефон")]
|
||||
public string MobilePhone { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using BankDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -17,5 +18,20 @@ namespace BankDatabaseImplement
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
}
|
||||
public virtual DbSet<Account> Accounts { set; get; }
|
||||
|
||||
public virtual DbSet<Card> Cards { set; get; }
|
||||
|
||||
public virtual DbSet<Cashier> Cashiers { set; get; }
|
||||
|
||||
public virtual DbSet<CashWithdrawal> CashWithdrawals { set; get; }
|
||||
|
||||
public virtual DbSet<Client> Clients { set; get; }
|
||||
|
||||
public virtual DbSet<Debiting> Debitings { set; get; }
|
||||
|
||||
public virtual DbSet<Crediting> Creditings { set; get; }
|
||||
|
||||
public virtual DbSet<MoneyTransfer> MoneyTransfers { set; get; }
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
using BankContracts.BindingModels;
|
||||
using BankContracts.ViewModels;
|
||||
using BankContracts.ViewModels.Client.ViewModels;
|
||||
using BankDataModels.Enums;
|
||||
using BankDataModels.Models;
|
||||
using System;
|
||||
@ -13,7 +13,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace BankDatabaseImplement.Models
|
||||
{
|
||||
public class Card : ICardModel
|
||||
public class Card : ICardModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
using BankContracts.BindingModels;
|
||||
using BankContracts.StoragesModels;
|
||||
using BankContracts.ViewModels.Cashier.ViewModels;
|
||||
using BankDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -19,17 +20,17 @@ namespace BankDatabaseImplement.Models
|
||||
|
||||
//для передачи номера заявки
|
||||
public virtual Debiting Debiting { get; set; }
|
||||
|
||||
[Required]
|
||||
public int AccountId { get; set; }
|
||||
//я думаю нам стоит в пехе встретиться и обсудить наши модели, потому что реально странно, что наши операции не связаны с картами/счетами
|
||||
//[Required]
|
||||
//public int AccountId { get; set; }
|
||||
|
||||
//для передачи названия изделия
|
||||
public virtual Account Account { get; set; }
|
||||
//public virtual Account Account { get; set; }
|
||||
|
||||
[Required]
|
||||
public int CashierId { get; set; }
|
||||
|
||||
//для передачи фамилии кассира
|
||||
//для передачи данных о кассире
|
||||
public virtual Cashier Cashier { get; set; }
|
||||
|
||||
[Required]
|
||||
@ -43,8 +44,6 @@ namespace BankDatabaseImplement.Models
|
||||
return new CashWithdrawal()
|
||||
{
|
||||
Id = model.Id,
|
||||
AccountId = model.AccountId,
|
||||
Account = context.Accounts.First(x => x.Id == model.AccountId),
|
||||
DebitingId = model.DebitingId,
|
||||
Debiting = context.Debitings.First(x => x.Id == model.DebitingId),
|
||||
CashierId = model.CashierId,
|
||||
@ -62,13 +61,8 @@ namespace BankDatabaseImplement.Models
|
||||
public CashWithdrawalViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
AccountId = AccountId,
|
||||
CashierId = CashierId,
|
||||
DebitingId = DebitingId,
|
||||
AccountNumber = Account.AccountNumber,
|
||||
SurmaneCashier = Cashier.Surname,
|
||||
DebbitingNumber = Debiting.Id,
|
||||
DebitingStatus = Debiting.Status,
|
||||
Sum = Sum,
|
||||
DateWithdrawal = DateWithdrawal
|
||||
};
|
||||
|
@ -1,5 +1,4 @@
|
||||
using BankContracts.BindingModels;
|
||||
using BankContracts.ViewModels;
|
||||
using BankDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -8,6 +7,7 @@ using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using BankContracts.ViewModels.Cashier.ViewModels;
|
||||
|
||||
namespace BankDatabaseImplement.Models
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
using BankContracts.BindingModels;
|
||||
using BankContracts.ViewModels;
|
||||
using BankContracts.ViewModels.Client.ViewModels;
|
||||
using BankDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -11,7 +11,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace BankDatabaseImplement.Models
|
||||
{
|
||||
public class Client : IClientModel
|
||||
public class Client : IClientModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
|
59
Bank/BankDatabaseImplement/Models/Crediting.cs
Normal file
59
Bank/BankDatabaseImplement/Models/Crediting.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using BankContracts.BindingModels;
|
||||
using BankContracts.ViewModels.Client.ViewModels;
|
||||
using BankDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BankDatabaseImplement.Models
|
||||
{
|
||||
public class Crediting : ICreditingModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int ClientId { get; set; }
|
||||
|
||||
//это надо будет, если
|
||||
//public virtual Card Card { get; set; }
|
||||
|
||||
[Required]
|
||||
public double Sum { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTime DateCredit { get; set; } = DateTime.Now;
|
||||
|
||||
//для реализации связи один ко многим с переводом денег
|
||||
[ForeignKey("CreditingId")]
|
||||
public virtual List<MoneyTransfer> MoneyTransfers { get; set; } = new();
|
||||
|
||||
public CreditingViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
ClientId = ClientId,
|
||||
Sum = Sum,
|
||||
DateCredit = DateCredit,
|
||||
};
|
||||
|
||||
public static Crediting Create(BankDatabase context, CreditingBindingModel model)
|
||||
{
|
||||
return new Crediting()
|
||||
{
|
||||
Id = model.Id,
|
||||
ClientId = model.ClientId,
|
||||
|
||||
Sum = model.Sum,
|
||||
DateCredit = model.DateCredit,
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(CreditingBindingModel model)
|
||||
{
|
||||
DateCredit = model.DateCredit;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
using BankDataModels.Models;
|
||||
using BankContracts.BindingModels;
|
||||
using BankContracts.ViewModels.Client.ViewModels;
|
||||
using BankDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
@ -12,10 +14,6 @@ namespace BankDatabaseImplement.Models
|
||||
{
|
||||
//реализация операции на пополнение
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int CardId { get; set; }
|
||||
public virtual Card Card { get; set; }
|
||||
[Required]
|
||||
public int ClientId { get; set; }
|
||||
public virtual Client Client { get; set; }
|
||||
@ -23,13 +21,10 @@ namespace BankDatabaseImplement.Models
|
||||
public double Sum { get; set; }
|
||||
[Required]
|
||||
public DateTime DateDebit { get; set; } = DateTime.Now;
|
||||
}
|
||||
|
||||
public DebitingViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
CardId = CardId,
|
||||
CardNumber = Card.Number,
|
||||
ClientId = ClientId,
|
||||
Sum = Sum,
|
||||
DateDebit = DateDebit,
|
||||
@ -40,8 +35,6 @@ namespace BankDatabaseImplement.Models
|
||||
return new Debiting()
|
||||
{
|
||||
Id = model.Id,
|
||||
CardId = model.CardId,
|
||||
Card = context.Cards.First(x => x.Id == model.CardId),
|
||||
ClientId = model.ClientId,
|
||||
Sum = model.Sum,
|
||||
DateDebit = model.DateDebit,
|
||||
@ -50,9 +43,7 @@ namespace BankDatabaseImplement.Models
|
||||
//вот тут хз, надо ли обновлять эту операцию, если судить чисто логически, то не надо ОБДУМАТЬ!!!!!!!!
|
||||
public void Update(DebitingBindingModel model)
|
||||
{
|
||||
DateClose = model.DateClose;
|
||||
|
||||
Status = model.Status;
|
||||
DateDebit = model.DateDebit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using BankContracts.BindingModels;
|
||||
using BankContracts.ViewModels.Cashier.ViewModels;
|
||||
using BankDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -24,16 +25,10 @@ namespace BankDatabaseImplement.Models
|
||||
[Required]
|
||||
public DateTime DateTransfer { get; set; }
|
||||
|
||||
public int? CreditingId { get; set; }
|
||||
|
||||
public int CashierId { get; set; }
|
||||
|
||||
public virtual Cashier Cashier { get; set; }
|
||||
|
||||
public virtual Account AccountSender { get; set; }
|
||||
|
||||
public virtual Account AccountPayeer { get; set; }
|
||||
|
||||
public static MoneyTransfer Create(BankDatabase context, MoneyTransferBindingModel model)
|
||||
{
|
||||
return new MoneyTransfer()
|
||||
@ -41,12 +36,7 @@ namespace BankDatabaseImplement.Models
|
||||
Id = model.Id,
|
||||
Sum = model.Sum,
|
||||
Cashier = context.Cashiers.First(x => x.Id == model.CashierId),
|
||||
AccountSender = model.AccountSenderId == null ? null : context.Accounts.First(x => x.Id == model.AccountSenderId),
|
||||
AccountPayeer = context.Accounts.First(x => x.Id == model.AccountPayeeId),
|
||||
AccountSenderId = model.AccountSenderId,
|
||||
AccountPayeeId = model.AccountPayeeId,
|
||||
DateTransfer = model.DateTransfer,
|
||||
CreditingId = model.CreditingId,
|
||||
CashierId = model.CashierId
|
||||
};
|
||||
}
|
||||
@ -60,13 +50,8 @@ namespace BankDatabaseImplement.Models
|
||||
public MoneyTransferViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
AccountPayeeId = AccountPayeeId,
|
||||
AccountSenderId = AccountSenderId,
|
||||
AccountPayeeNumber = AccountPayeer.AccountNumber,
|
||||
AccountSenderNumber = AccountSenderId == null ? null : AccountSender.AccountNumber,
|
||||
DateTransfer = DateTransfer,
|
||||
Sum = Sum,
|
||||
CreditingId = CreditingId,
|
||||
CashierId = CashierId,
|
||||
CashierSurname = Cashier.Surname
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user