Оператор связан со всеми сущностями роли Заказчик (+ сопутсвующие фиксы), фикс недостающей ссылки на CreditProgram в классе Deal
This commit is contained in:
parent
dc7065bc50
commit
9292d3c422
@ -9,12 +9,13 @@ namespace BankContracts.BindingModels
|
|||||||
{
|
{
|
||||||
public class PaymentBindingModel : IPaymentModel
|
public class PaymentBindingModel : IPaymentModel
|
||||||
{
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
public DateTime PaymentDate {get;set;} = DateTime.Now.Date;
|
public DateTime PaymentDate {get;set;} = DateTime.Now.Date;
|
||||||
|
|
||||||
public Dictionary<int, IDealModel> DealPayments { get; set; } = new();
|
public Dictionary<int, IDealModel> DealPayments { get; set; } = new();
|
||||||
|
|
||||||
public Dictionary<int, ICurrencyModel> CurrencyPayments { get; set; } = new();
|
public Dictionary<int, ICurrencyModel> CurrencyPayments { get; set; } = new();
|
||||||
|
|
||||||
public int Id { get; set; }
|
public int OperatorId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,12 +9,13 @@ namespace BankContracts.BindingModels
|
|||||||
{
|
{
|
||||||
public class TransferBindingModel : ITransferModel
|
public class TransferBindingModel : ITransferModel
|
||||||
{
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
public float Amount { get; set; }
|
public float Amount { get; set; }
|
||||||
|
|
||||||
public DateTime TransferDateTime { get; set; } = DateTime.Now;
|
public DateTime TransferDateTime { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
public int PaymentId { get; set; }
|
public int PaymentId { get; set; }
|
||||||
|
|
||||||
public int Id { get; set; }
|
public int OperatorId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,5 +9,6 @@ namespace BankContracts.SearchModels
|
|||||||
public class PaymentSearchModel
|
public class PaymentSearchModel
|
||||||
{
|
{
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
|
public int? OperatorId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,5 +9,6 @@ namespace BankContracts.SearchModels
|
|||||||
public class TransferSearchModel
|
public class TransferSearchModel
|
||||||
{
|
{
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
|
public int? OperatorId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,12 +10,14 @@ namespace BankContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public class PaymentViewModel : IPaymentModel
|
public class PaymentViewModel : IPaymentModel
|
||||||
{
|
{
|
||||||
|
[DisplayName("Номер платы")]
|
||||||
|
public int Id { get; set; }
|
||||||
[DisplayName("Дата платы")]
|
[DisplayName("Дата платы")]
|
||||||
public DateTime PaymentDate { get; set; } = DateTime.Now.Date;
|
public DateTime PaymentDate { get; set; } = DateTime.Now.Date;
|
||||||
public Dictionary<int, IDealModel> DealPayments { get; set; } = new();
|
public Dictionary<int, IDealModel> DealPayments { get; set; } = new();
|
||||||
|
|
||||||
public Dictionary<int, ICurrencyModel> CurrencyPayments { get; set; } = new();
|
public Dictionary<int, ICurrencyModel> CurrencyPayments { get; set; } = new();
|
||||||
[DisplayName("Номер платы")]
|
public int OperatorId { get; set; }
|
||||||
public int Id { get; set; }
|
[DisplayName("ФИО оператора")]
|
||||||
|
public string OperatorName { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,5 +18,8 @@ namespace BankContracts.ViewModels
|
|||||||
public DateTime TransferDateTime {get; set;} = DateTime.Now;
|
public DateTime TransferDateTime {get; set;} = DateTime.Now;
|
||||||
[DisplayName("Номер платежа")]
|
[DisplayName("Номер платежа")]
|
||||||
public int PaymentId {get; set;}
|
public int PaymentId {get; set;}
|
||||||
|
public int OperatorId { get; set; }
|
||||||
|
[DisplayName("ФИО оператора")]
|
||||||
|
public string OperatorName { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,5 +11,6 @@ namespace BankDataModels.Models
|
|||||||
DateTime PaymentDate { get; }
|
DateTime PaymentDate { get; }
|
||||||
Dictionary<int, IDealModel> DealPayments { get; }
|
Dictionary<int, IDealModel> DealPayments { get; }
|
||||||
Dictionary<int, ICurrencyModel> CurrencyPayments { get; }
|
Dictionary<int, ICurrencyModel> CurrencyPayments { get; }
|
||||||
|
int OperatorId { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,5 +11,6 @@ namespace BankDataModels.Models
|
|||||||
float Amount { get; }
|
float Amount { get; }
|
||||||
DateTime TransferDateTime { get; }
|
DateTime TransferDateTime { get; }
|
||||||
int PaymentId { get; }
|
int PaymentId { get; }
|
||||||
|
int OperatorId { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ namespace BankDatabaseImplement.Implements
|
|||||||
public List<DealViewModel> GetFullList()
|
public List<DealViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
using var context = new BankDatabase();
|
using var context = new BankDatabase();
|
||||||
return context.Deals.Include(x => x.Operator)
|
return context.Deals.Include(x => x.Operator).Include(x => x.CreditProgram)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ namespace BankDatabaseImplement.Implements
|
|||||||
if (model.OperatorId.HasValue)
|
if (model.OperatorId.HasValue)
|
||||||
{
|
{
|
||||||
using var context = new BankDatabase();
|
using var context = new BankDatabase();
|
||||||
return context.Deals.Include(x => x.Operator)
|
return context.Deals.Include(x => x.Operator).Include(x => x.CreditProgram)
|
||||||
.Where(x => x.OperatorId == model.OperatorId)
|
.Where(x => x.OperatorId == model.OperatorId)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
@ -38,7 +38,7 @@ namespace BankDatabaseImplement.Implements
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
using var context = new BankDatabase();
|
using var context = new BankDatabase();
|
||||||
return context.Deals.Include(x => x.Operator)
|
return context.Deals.Include(x => x.Operator).Include(x => x.CreditProgram)
|
||||||
.Where(x => x.Id == model.Id)
|
.Where(x => x.Id == model.Id)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
@ -51,7 +51,7 @@ namespace BankDatabaseImplement.Implements
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
using var context = new BankDatabase();
|
using var context = new BankDatabase();
|
||||||
return context.Deals.Include(x => x.Operator)
|
return context.Deals.Include(x => x.Operator).Include(x => x.CreditProgram)
|
||||||
.FirstOrDefault(x => x.Id == model.Id)
|
.FirstOrDefault(x => x.Id == model.Id)
|
||||||
?.GetViewModel;
|
?.GetViewModel;
|
||||||
}
|
}
|
||||||
|
@ -17,21 +17,33 @@ namespace BankDatabaseImplement.Implements
|
|||||||
public List<PaymentViewModel> GetFullList()
|
public List<PaymentViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
using var context = new BankDatabase();
|
using var context = new BankDatabase();
|
||||||
return context.Payments
|
return context.Payments.Include(x => x.Operator)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
public List<PaymentViewModel> GetFilteredList(PaymentSearchModel model)
|
public List<PaymentViewModel> GetFilteredList(PaymentSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue)
|
if (!model.Id.HasValue && !model.OperatorId.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
using var context = new BankDatabase();
|
if (model.OperatorId.HasValue)
|
||||||
return context.Payments
|
{
|
||||||
.Where(x => x.Id == model.Id)
|
using var context = new BankDatabase();
|
||||||
.Select(x => x.GetViewModel)
|
return context.Payments.Include(x => x.Operator)
|
||||||
.ToList();
|
.Where(x => x.OperatorId == model.OperatorId)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
using var context = new BankDatabase();
|
||||||
|
return context.Payments.Include(x => x.Operator)
|
||||||
|
.Where(x => x.Id == model.Id)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public PaymentViewModel? GetElement(PaymentSearchModel model)
|
public PaymentViewModel? GetElement(PaymentSearchModel model)
|
||||||
{
|
{
|
||||||
@ -40,7 +52,7 @@ namespace BankDatabaseImplement.Implements
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
using var context = new BankDatabase();
|
using var context = new BankDatabase();
|
||||||
return context.Payments
|
return context.Payments.Include(x => x.Operator)
|
||||||
.FirstOrDefault(x => x.Id == model.Id)
|
.FirstOrDefault(x => x.Id == model.Id)
|
||||||
?.GetViewModel;
|
?.GetViewModel;
|
||||||
}
|
}
|
||||||
|
@ -17,21 +17,32 @@ namespace BankDatabaseImplement.Implements
|
|||||||
public List<TransferViewModel> GetFullList()
|
public List<TransferViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
using var context = new BankDatabase();
|
using var context = new BankDatabase();
|
||||||
return context.Transfers.Include(x => x.Payment)
|
return context.Transfers.Include(x => x.Payment).Include(x => x.OperatorId)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
public List<TransferViewModel> GetFilteredList(TransferSearchModel model)
|
public List<TransferViewModel> GetFilteredList(TransferSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue)
|
if (!model.Id.HasValue && !model.OperatorId.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
using var context = new BankDatabase();
|
if (model.OperatorId.HasValue)
|
||||||
return context.Transfers.Include(x => x.Payment)
|
{
|
||||||
.Where(x => x.Id == model.Id)
|
using var context = new BankDatabase();
|
||||||
.Select(x => x.GetViewModel)
|
return context.Transfers.Include(x => x.Payment).Include(x => x.OperatorId)
|
||||||
.ToList();
|
.Where(x => x.OperatorId == model.OperatorId)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
using var context = new BankDatabase();
|
||||||
|
return context.Transfers.Include(x => x.Payment).Include(x => x.OperatorId)
|
||||||
|
.Where(x => x.Id == model.Id)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public TransferViewModel? GetElement(TransferSearchModel model)
|
public TransferViewModel? GetElement(TransferSearchModel model)
|
||||||
{
|
{
|
||||||
@ -40,7 +51,7 @@ namespace BankDatabaseImplement.Implements
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
using var context = new BankDatabase();
|
using var context = new BankDatabase();
|
||||||
return context.Transfers.Include(x => x.Payment)
|
return context.Transfers.Include(x => x.Payment).Include(x => x.OperatorId)
|
||||||
.FirstOrDefault(x => x.Id == model.Id)
|
.FirstOrDefault(x => x.Id == model.Id)
|
||||||
?.GetViewModel;
|
?.GetViewModel;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ namespace BankDatabaseImplement.Models
|
|||||||
public int OperatorId { get; set; }
|
public int OperatorId { get; set; }
|
||||||
public virtual Operator Operator { get; set; } = new();
|
public virtual Operator Operator { get; set; } = new();
|
||||||
public int? CreditProgramId {get; set; }
|
public int? CreditProgramId {get; set; }
|
||||||
|
public virtual CreditProgram CreditProgram { get; set; } = new();
|
||||||
[ForeignKey("DealId")]
|
[ForeignKey("DealId")]
|
||||||
public virtual List<DealPayment> DealPayments { get; set; } = new();
|
public virtual List<DealPayment> DealPayments { get; set; } = new();
|
||||||
public static Deal? Create(BankDatabase context, DealBindingModel model)
|
public static Deal? Create(BankDatabase context, DealBindingModel model)
|
||||||
|
@ -46,6 +46,9 @@ namespace BankDatabaseImplement.Models
|
|||||||
}
|
}
|
||||||
public virtual List<CurrencyPayment> Currencies { get; set; } = new();
|
public virtual List<CurrencyPayment> Currencies { get; set; } = new();
|
||||||
|
|
||||||
|
public int OperatorId { get; set; }
|
||||||
|
public virtual Operator Operator { get; set; } = new();
|
||||||
|
|
||||||
public static Payment? Create(BankDatabase context, PaymentBindingModel model)
|
public static Payment? Create(BankDatabase context, PaymentBindingModel model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
@ -76,6 +79,8 @@ namespace BankDatabaseImplement.Models
|
|||||||
PaymentDate = PaymentDate,
|
PaymentDate = PaymentDate,
|
||||||
DealPayments = DealPayments,
|
DealPayments = DealPayments,
|
||||||
CurrencyPayments = CurrencyPayments,
|
CurrencyPayments = CurrencyPayments,
|
||||||
|
OperatorId = OperatorId,
|
||||||
|
OperatorName = Operator.LastName + " " + Operator.FirstName + " " + Operator.MiddleName,
|
||||||
};
|
};
|
||||||
public void UpdateDeals(BankDatabase context, PaymentBindingModel model)
|
public void UpdateDeals(BankDatabase context, PaymentBindingModel model)
|
||||||
{
|
{
|
||||||
|
@ -20,6 +20,8 @@ namespace BankDatabaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public int PaymentId { get; set; }
|
public int PaymentId { get; set; }
|
||||||
public virtual Payment Payment { get; set; } = new();
|
public virtual Payment Payment { get; set; } = new();
|
||||||
|
public int OperatorId { get; set; }
|
||||||
|
public virtual Operator Operator { get; set; } = new();
|
||||||
public static Transfer? Create(BankDatabase context, TransferBindingModel model)
|
public static Transfer? Create(BankDatabase context, TransferBindingModel model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
@ -59,7 +61,9 @@ namespace BankDatabaseImplement.Models
|
|||||||
Id = Id,
|
Id = Id,
|
||||||
TransferDateTime = TransferDateTime,
|
TransferDateTime = TransferDateTime,
|
||||||
Amount = Amount,
|
Amount = Amount,
|
||||||
PaymentId = PaymentId
|
PaymentId = PaymentId,
|
||||||
|
OperatorId = OperatorId,
|
||||||
|
OperatorName = Operator.LastName + " " + Operator.FirstName + " " + Operator.MiddleName,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user