ClientsModels

This commit is contained in:
shadowik 2023-04-01 16:49:22 +04:00
parent 459fc319ef
commit 2c89484fd4
2 changed files with 9 additions and 12 deletions

View File

@ -18,6 +18,8 @@ namespace BankYouBankruptDatabaseImplement.Models
[Required]
public int CardId { get; set; }
public virtual Card Card { get; set; } = new();
[Required]
public int Sum { get; set; }
@ -29,24 +31,21 @@ namespace BankYouBankruptDatabaseImplement.Models
{
Id = Id,
CardId = CardId,
CardNumber = Card.Number,
Sum = Sum,
Date = Date
};
public static Crediting Create(CreditingBindingModel model)
public static Crediting Create(BankYouBancruptDatabase context, CreditingBindingModel model)
{
return new Crediting()
{
Id = model.Id,
CardId = model.CardId,
Card = context.Cards.First(x => x.Id == model.CardId),
Sum = model.Sum,
Date = model.Date
};
}
public void Update(CreditingBindingModel model)
{
}
}
}

View File

@ -16,6 +16,7 @@ namespace BankYouBankruptDatabaseImplement.Models
[Required]
public int CardId { get; set; }
public virtual Card Card { get; set; } = new();
[Required]
public int Sum { get; set; }
@ -28,24 +29,21 @@ namespace BankYouBankruptDatabaseImplement.Models
{
Id = Id,
CardId = CardId,
CardNumber = Card.Number,
Sum = Sum,
Date = Date
};
public static Debiting Create(DebitingBindingModel model)
public static Debiting Create(BankYouBancruptDatabase context, DebitingBindingModel model)
{
return new Debiting()
{
Id = model.Id,
CardId = model.CardId,
Card = context.Cards.First(x => x.Id == model.CardId),
Sum = model.Sum,
Date = model.Date
};
}
public void Update(DebitingBindingModel model)
{
}
}
}