ClientsModels
This commit is contained in:
parent
de5194b463
commit
17057cf71f
@ -100,13 +100,13 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
{
|
||||
throw new ArgumentNullException("Сумма операции должна быть больше 0", nameof(model.Sum));
|
||||
}
|
||||
if (model.date < DateTime.Now)
|
||||
if (model.Date < DateTime.Now)
|
||||
{
|
||||
throw new ArgumentNullException("Дата не может быть меньше текущего времени", nameof(model.date));
|
||||
throw new ArgumentNullException("Дата не может быть меньше текущего времени", nameof(model.Date));
|
||||
}
|
||||
|
||||
_logger.LogInformation("Crediting. Sum:{Sum}.CardId:{CardId}.Date:{date}.Id:{Id}",
|
||||
model.Sum, model.CardId, model.date.ToString(), model.Id);
|
||||
model.Sum, model.CardId, model.Date.ToString(), model.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,13 +100,13 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
||||
{
|
||||
throw new ArgumentNullException("Сумма операции должна быть больше 0", nameof(model.Sum));
|
||||
}
|
||||
if (model.date < DateTime.Now)
|
||||
if (model.Date < DateTime.Now)
|
||||
{
|
||||
throw new ArgumentNullException("Дата не может быть меньше текущего времени", nameof(model.date));
|
||||
throw new ArgumentNullException("Дата не может быть меньше текущего времени", nameof(model.Date));
|
||||
}
|
||||
|
||||
_logger.LogInformation("Debiting. Sum:{Sum}.CardId:{CardId}.Date:{date}.Id:{Id}",
|
||||
model.Sum, model.CardId, model.date.ToString(), model.Id);
|
||||
model.Sum, model.CardId, model.Date.ToString(), model.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,6 @@ namespace BankYouBankruptContracts.BindingModels
|
||||
|
||||
public int Sum { get; set; }
|
||||
|
||||
public DateTime date { get; set; } = DateTime.Now;
|
||||
public DateTime Date { get; set; } = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,6 @@ namespace BankYouBankruptContracts.BindingModels
|
||||
|
||||
public int Sum { get; set; }
|
||||
|
||||
public DateTime date { get; set; } = DateTime.Now;
|
||||
public DateTime Date { get; set; } = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,6 @@ namespace BankYouBankruptContracts.ViewModels
|
||||
public int Sum { get; set; }
|
||||
|
||||
[DisplayName("Дата операции")]
|
||||
public DateTime date { get; set; } = DateTime.Now;
|
||||
public DateTime Date { get; set; } = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,6 @@ namespace BankYouBankruptContracts.ViewModels
|
||||
public int Sum { get; set; }
|
||||
|
||||
[DisplayName("Дата операции")]
|
||||
public DateTime date { get; set; } = DateTime.Now;
|
||||
public DateTime Date { get; set; } = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,6 @@ namespace BankYouBankruptDataModels.Models
|
||||
|
||||
int Sum { get; }
|
||||
|
||||
DateTime date { get; }
|
||||
DateTime Date { get; }
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,6 @@ namespace BankYouBankruptDataModels.Models
|
||||
|
||||
int Sum { get; }
|
||||
|
||||
DateTime date { get; }
|
||||
DateTime Date { get; }
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
using BankYouBankruptDataModels.Models;
|
||||
using BankYouBankruptContracts.BindingModels;
|
||||
using BankYouBankruptContracts.ViewModels;
|
||||
using BankYouBankruptDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -9,16 +12,47 @@ namespace BankYouBankruptDatabaseImplement.Models
|
||||
{
|
||||
public class Card : ICardModel
|
||||
{
|
||||
public int ClientID => throw new NotImplementedException();
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public int ClientID { get; set; }
|
||||
|
||||
public int AccountId => throw new NotImplementedException();
|
||||
public virtual Client Client { get; set; } = new();
|
||||
[Required]
|
||||
public int AccountId { get; set; }
|
||||
[Required]
|
||||
public string Number { get; set; } = String.Empty;
|
||||
[Required]
|
||||
public string CVC { get; set; }
|
||||
[Required]
|
||||
public DateTime Period { get; set; } = DateTime.Now;
|
||||
|
||||
public string Number => throw new NotImplementedException();
|
||||
public CardViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
ClientID = ClientID,
|
||||
ClientSurname = Client.Surname,
|
||||
Number = Number,
|
||||
Period = Period,
|
||||
CVC = CVC
|
||||
};
|
||||
|
||||
public string CVC => throw new NotImplementedException();
|
||||
public static Card Create(BankYouBancruptDatabase context, CardBindingModel model)
|
||||
{
|
||||
return new Card()
|
||||
{
|
||||
Id = model.Id,
|
||||
ClientID = model.ClientID,
|
||||
Client = context.Clients.First(x => x.Id == model.ClientID),
|
||||
Number = model.Number,
|
||||
Period = model.Period,
|
||||
CVC = model.CVC
|
||||
};
|
||||
}
|
||||
|
||||
public DateTime Period => throw new NotImplementedException();
|
||||
|
||||
public int Id => throw new NotImplementedException();
|
||||
public void Update(CardBindingModel model)
|
||||
{
|
||||
Period = model.Period;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,10 @@
|
||||
using BankYouBankruptDataModels.Models;
|
||||
using BankYouBankruptContracts.BindingModels;
|
||||
using BankYouBankruptContracts.ViewModels;
|
||||
using BankYouBankruptDataModels.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;
|
||||
@ -9,18 +13,61 @@ namespace BankYouBankruptDatabaseImplement.Models
|
||||
{
|
||||
public class Client : IClientModel
|
||||
{
|
||||
public string Password => throw new NotImplementedException();
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name => throw new NotImplementedException();
|
||||
[Required]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
public string Surname => throw new NotImplementedException();
|
||||
[Required]
|
||||
public string Surname { get; set; } = string.Empty;
|
||||
|
||||
public string Patronymic => throw new NotImplementedException();
|
||||
[Required]
|
||||
public string Patronymic { get; set; } = string.Empty;
|
||||
|
||||
public string Email => throw new NotImplementedException();
|
||||
[Required]
|
||||
public string Telephone { get; set; } = string.Empty;
|
||||
|
||||
public string Telephone => throw new NotImplementedException();
|
||||
[Required]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
public int Id => throw new NotImplementedException();
|
||||
[Required]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
|
||||
public ClientViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
Surname = Surname,
|
||||
Patronymic = Patronymic,
|
||||
Telephone = Telephone,
|
||||
Email = Email,
|
||||
Password = Password
|
||||
};
|
||||
|
||||
public static Client Create(ClientBindingModel model)
|
||||
{
|
||||
return new Client()
|
||||
{
|
||||
Id = model.Id,
|
||||
Name = model.Name,
|
||||
Surname = model.Surname,
|
||||
Patronymic = model.Patronymic,
|
||||
Telephone = model.Telephone,
|
||||
Email = model.Email,
|
||||
Password = model.Password
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(ClientBindingModel model)
|
||||
{
|
||||
Name = model.Name;
|
||||
Surname = model.Surname;
|
||||
Patronymic = model.Patronymic;
|
||||
Telephone = model.Telephone;
|
||||
Email = model.Email;
|
||||
Password = model.Password;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
using BankYouBankruptDataModels.Models;
|
||||
using BankYouBankruptContracts.BindingModels;
|
||||
using BankYouBankruptContracts.ViewModels;
|
||||
using BankYouBankruptDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -9,12 +12,41 @@ namespace BankYouBankruptDatabaseImplement.Models
|
||||
{
|
||||
public class Crediting : ICreditingModel
|
||||
{
|
||||
public int CardId => throw new NotImplementedException();
|
||||
|
||||
public int Sum => throw new NotImplementedException();
|
||||
public int Id { get; set; }
|
||||
|
||||
public DateTime date => throw new NotImplementedException();
|
||||
[Required]
|
||||
public int CardId { get; set; }
|
||||
|
||||
[Required]
|
||||
public int Sum { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTime Date { get; set; } = DateTime.Now;
|
||||
|
||||
|
||||
public CreditingViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
CardId = CardId,
|
||||
Sum = Sum,
|
||||
Date = Date
|
||||
};
|
||||
|
||||
public static Crediting Create(CreditingBindingModel model)
|
||||
{
|
||||
return new Crediting()
|
||||
{
|
||||
Id = model.Id,
|
||||
CardId = model.CardId,
|
||||
Sum = model.Sum,
|
||||
Date = model.Date
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(CreditingBindingModel model)
|
||||
{
|
||||
|
||||
public int Id => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
using BankYouBankruptDataModels.Models;
|
||||
using BankYouBankruptContracts.BindingModels;
|
||||
using BankYouBankruptContracts.ViewModels;
|
||||
using BankYouBankruptDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -9,12 +12,40 @@ namespace BankYouBankruptDatabaseImplement.Models
|
||||
{
|
||||
public class Debiting : IDebitingModel
|
||||
{
|
||||
public int CardId => throw new NotImplementedException();
|
||||
public int Id { get; set; }
|
||||
|
||||
public int Sum => throw new NotImplementedException();
|
||||
[Required]
|
||||
public int CardId { get; set; }
|
||||
|
||||
public DateTime date => throw new NotImplementedException();
|
||||
[Required]
|
||||
public int Sum { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTime Date { get; set; } = DateTime.Now;
|
||||
|
||||
|
||||
public DebitingViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
CardId = CardId,
|
||||
Sum = Sum,
|
||||
Date = Date
|
||||
};
|
||||
|
||||
public static Debiting Create(DebitingBindingModel model)
|
||||
{
|
||||
return new Debiting()
|
||||
{
|
||||
Id = model.Id,
|
||||
CardId = model.CardId,
|
||||
Sum = model.Sum,
|
||||
Date = model.Date
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(DebitingBindingModel model)
|
||||
{
|
||||
|
||||
public int Id => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user