Снова правки
This commit is contained in:
parent
5fd23d0bc0
commit
de25c5ce83
@ -21,6 +21,7 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
|||||||
using var context = new BankYouBancruptDatabase();
|
using var context = new BankYouBancruptDatabase();
|
||||||
|
|
||||||
return context.Debitings
|
return context.Debitings
|
||||||
|
.Include(x => x.Card)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
@ -38,13 +39,15 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
|||||||
if(model.Status != StatusEnum.Закрыта)
|
if(model.Status != StatusEnum.Закрыта)
|
||||||
{
|
{
|
||||||
return context.Debitings
|
return context.Debitings
|
||||||
|
.Include(x => x.Card)
|
||||||
.Where(x => x.Status == StatusEnum.Открыта)
|
.Where(x => x.Status == StatusEnum.Открыта)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return context.Debitings
|
return context.Debitings
|
||||||
.Where(x => x.CardId == model.CardId)
|
.Include(x => x.Card)
|
||||||
|
.Where(x => x.CardId == model.CardId)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
@ -59,7 +62,8 @@ namespace BankYouBankruptDatabaseImplement.Implements
|
|||||||
using var context = new BankYouBancruptDatabase();
|
using var context = new BankYouBancruptDatabase();
|
||||||
|
|
||||||
return context.Debitings
|
return context.Debitings
|
||||||
.FirstOrDefault(x => (!(model.CardId < 0) && x.CardId == model.CardId) ||
|
.Include(x => x.Card)
|
||||||
|
.FirstOrDefault(x => (!(model.CardId < 0) && x.CardId == model.CardId) ||
|
||||||
(model.Id.HasValue && x.Id == model.Id))
|
(model.Id.HasValue && x.Id == model.Id))
|
||||||
?.GetViewModel;
|
?.GetViewModel;
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ namespace BankYouBankruptDatabaseImplement.Models
|
|||||||
public int ClientId { get; set; }
|
public int ClientId { get; set; }
|
||||||
|
|
||||||
//для передачи ФИО клиента
|
//для передачи ФИО клиента
|
||||||
public virtual Client Client { get; set; } = new();
|
public virtual Client Client { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string PasswordAccount { get; set; } = string.Empty;
|
public string PasswordAccount { get; set; } = string.Empty;
|
||||||
@ -58,6 +58,7 @@ namespace BankYouBankruptDatabaseImplement.Models
|
|||||||
{
|
{
|
||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
ClientId = model.ClientId,
|
ClientId = model.ClientId,
|
||||||
|
Client = context.Clients.First(x => x.Id == model.ClientId),
|
||||||
PasswordAccount = model.PasswordAccount,
|
PasswordAccount = model.PasswordAccount,
|
||||||
Balance = model.Balance,
|
Balance = model.Balance,
|
||||||
DateOpen = model.DateOpen,
|
DateOpen = model.DateOpen,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using BankYouBankruptContracts.BindingModels;
|
using BankYouBankruptContracts.BindingModels;
|
||||||
using BankYouBankruptContracts.ViewModels;
|
using BankYouBankruptContracts.ViewModels;
|
||||||
using BankYouBankruptDataModels.Models;
|
using BankYouBankruptDataModels.Models;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
@ -18,18 +19,18 @@ namespace BankYouBankruptDatabaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public int ClientID { get; set; }
|
public int ClientID { get; set; }
|
||||||
|
|
||||||
public virtual Client Client { get; set; } = new();
|
public virtual Client Client { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public int AccountId { get; set; }
|
public int AccountId { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string Number { get; set; } = String.Empty;
|
public string Number { get; set; } = string.Empty;
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string CVC { get; set; }
|
public string CVC { get; set; } = string.Empty;
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public DateTime Period { get; set; } = DateTime.Now;
|
public DateTime Period { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
[ForeignKey("CardId")]
|
[ForeignKey("CardId")]
|
||||||
@ -56,6 +57,7 @@ namespace BankYouBankruptDatabaseImplement.Models
|
|||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
AccountId = model.AccountId,
|
AccountId = model.AccountId,
|
||||||
ClientID = model.ClientID,
|
ClientID = model.ClientID,
|
||||||
|
Client = context.Clients.First(x => x.Id == model.ClientID),
|
||||||
Number = model.Number,
|
Number = model.Number,
|
||||||
Period = model.Period,
|
Period = model.Period,
|
||||||
CVC = model.CVC
|
CVC = model.CVC
|
||||||
|
@ -18,7 +18,7 @@ namespace BankYouBankruptDatabaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public int CardId { get; set; }
|
public int CardId { get; set; }
|
||||||
|
|
||||||
public virtual Card Card { get; set; } = new();
|
public virtual Card Card { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public int Sum { get; set; }
|
public int Sum { get; set; }
|
||||||
|
@ -18,7 +18,7 @@ namespace BankYouBankruptDatabaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public int CardId { get; set; }
|
public int CardId { get; set; }
|
||||||
|
|
||||||
public virtual Card Card { get; set; } = new();
|
public virtual Card Card { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public int Sum { get; set; }
|
public int Sum { get; set; }
|
||||||
@ -49,10 +49,9 @@ namespace BankYouBankruptDatabaseImplement.Models
|
|||||||
{
|
{
|
||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
CardId = model.CardId,
|
CardId = model.CardId,
|
||||||
Card = context.Cards.First(x => x.Id == model.CardId),
|
|
||||||
Sum = model.Sum,
|
Sum = model.Sum,
|
||||||
DateOpen = model.DateOpen,
|
DateOpen = model.DateOpen,
|
||||||
Status = model.Status
|
Status = StatusEnum.Открыта
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user