diff --git a/University/UniversityContracts/BindingModels/PaymentBindingModel.cs b/University/UniversityContracts/BindingModels/PaymentBindingModel.cs index cb6390b..2bad4cf 100644 --- a/University/UniversityContracts/BindingModels/PaymentBindingModel.cs +++ b/University/UniversityContracts/BindingModels/PaymentBindingModel.cs @@ -8,7 +8,8 @@ namespace UniversityContracts.BindingModels { public class PaymentBindingModel { - public DateOnly Date { get; set; } = DateOnly.FromDateTime(DateTime.Now); + public DateTime DateCreate { get; set; } = DateTime.Now; + public double PaidPrice { get; set; } diff --git a/University/UniversityContracts/SearchModels/PaymentSearchModel.cs b/University/UniversityContracts/SearchModels/PaymentSearchModel.cs index 6d22e79..0f16d22 100644 --- a/University/UniversityContracts/SearchModels/PaymentSearchModel.cs +++ b/University/UniversityContracts/SearchModels/PaymentSearchModel.cs @@ -12,7 +12,7 @@ namespace UniversityContracts.SearchModels public int? ClassId { get; set; } public int? PurchaseId { get; set; } - public DateOnly? DateFrom { get; set; } - public DateOnly? DateTo { get; set; } + public DateTime? DateFrom { get; set; } + public DateTime? DateTo { get; set; } } } \ No newline at end of file diff --git a/University/UniversityContracts/ViewModels/PaymentViewModel.cs b/University/UniversityContracts/ViewModels/PaymentViewModel.cs index 2329616..7f009a3 100644 --- a/University/UniversityContracts/ViewModels/PaymentViewModel.cs +++ b/University/UniversityContracts/ViewModels/PaymentViewModel.cs @@ -20,7 +20,7 @@ namespace BankContracts.ViewModels public double PaidPrice { get; set; } public int ClassByPurchaseId { get; set; } [DisplayName("Дата оплаты")] - public DateOnly Date { get; set; } = DateOnly.FromDateTime(DateTime.Now); + public DateTime DateCreate { get; set; } = DateTime.Now; public ClassByPurchaseModel ClassByPurchase { get; set; } // Машины для отчета за период diff --git a/University/UniversityDataModels/IPaymentModel.cs b/University/UniversityDataModels/IPaymentModel.cs index 5fd5749..1556bc1 100644 --- a/University/UniversityDataModels/IPaymentModel.cs +++ b/University/UniversityDataModels/IPaymentModel.cs @@ -9,7 +9,7 @@ namespace UniversityDataModels public interface IPaymentModel : IId { double PaidPrice { get; } - DateOnly Date { get; } + DateTime DateCreate { get; } int ClassByPurchaseId { get; } } } diff --git a/University/UniversityDatabaseImplement/Implements/PaymentStorage.cs b/University/UniversityDatabaseImplement/Implements/PaymentStorage.cs index 940d180..de0324f 100644 --- a/University/UniversityDatabaseImplement/Implements/PaymentStorage.cs +++ b/University/UniversityDatabaseImplement/Implements/PaymentStorage.cs @@ -44,9 +44,9 @@ namespace UniversityDatabaseImplement.Implements using var context = new UniversityDB(); if (model.DateFrom.HasValue) return Payments(context) - .Where(x => model.DateFrom.Value <= x.Date && x.Date <= model.DateTo.Value) - .Select(x => x.GetViewModel) - .ToList(); + .Where(x => x.DateCreate >= model.DateFrom.Value && x.DateCreate <= model.DateTo.Value) + .Select(x => x.GetViewModel) + .ToList(); return Payments(context) .Where(x => x.ClassByPurchase != null && diff --git a/University/UniversityDatabaseImplement/Models/Payment.cs b/University/UniversityDatabaseImplement/Models/Payment.cs index 7f81edd..24357cd 100644 --- a/University/UniversityDatabaseImplement/Models/Payment.cs +++ b/University/UniversityDatabaseImplement/Models/Payment.cs @@ -13,7 +13,7 @@ namespace UniversityDatabaseImplement.Models public int ClassByPurchaseId { get; private set; } [Required] - public DateOnly Date { get; private set; } + public DateTime DateCreate { get; private set; } [Required] public double PaidPrice { get; private set; } @@ -32,8 +32,8 @@ namespace UniversityDatabaseImplement.Models return new Payment() { - Date = model.Date, - PaidPrice = model.PaidPrice, + DateCreate = model.DateCreate, + PaidPrice = model.PaidPrice, Id = model.Id, ClassByPurchaseId = model.ClassByPurchaseId, }; @@ -43,8 +43,8 @@ namespace UniversityDatabaseImplement.Models Operation = ClassByPurchase?.Class?.GetViewModel, ClassByPurchase = ClassByPurchase, FullPrice = ClassByPurchase?.Class?.Price ?? -1, - Date = Date, - PaidPrice = PaidPrice, + DateCreate = DateCreate, + PaidPrice = PaidPrice, Id = Id, ClassByPurchaseId = ClassByPurchaseId, }; diff --git a/University/UniversityDatabaseImplement/UniversityDB.cs b/University/UniversityDatabaseImplement/UniversityDB.cs index 060b11f..172e5b2 100644 --- a/University/UniversityDatabaseImplement/UniversityDB.cs +++ b/University/UniversityDatabaseImplement/UniversityDB.cs @@ -11,7 +11,7 @@ namespace UniversityDatabaseImplement { if (optionsBuilder.IsConfigured == false) { - optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=UniversityDB;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); + optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=University;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); } base.OnConfiguring(optionsBuilder); }