From a39601fb5d8dcd067e6d4f25db9a4b2f7a6bfbc3 Mon Sep 17 00:00:00 2001 From: platoff aeeee Date: Mon, 29 Apr 2024 21:30:38 +0400 Subject: [PATCH] bd proccess --- .../GuarantorImplements/GuarantorStorage.cs | 12 +++ .../GuarantorImplements/GuideStorage.cs | 12 +++ .../GuarantorImplements/PlaceStorage.cs | 12 +++ .../GuarantorImplements/TripStorage.cs | 18 +++++ .../Models/GuarantorModels/Guarantor.cs | 78 +++++++++++++++++++ .../Models/GuarantorModels/Guide.cs | 12 +++ .../Models/GuarantorModels/Place.cs | 12 +++ .../Models/GuarantorModels/Trip.cs | 12 +++ .../TravelCompanyDatabase.cs | 40 ++++++++++ .../TravelCompanyDatabaseImplement.csproj | 8 +- 10 files changed, 214 insertions(+), 2 deletions(-) create mode 100644 TravelCompany/TravelCompanyDatabaseImplement/Implements/GuarantorImplements/GuarantorStorage.cs create mode 100644 TravelCompany/TravelCompanyDatabaseImplement/Implements/GuarantorImplements/GuideStorage.cs create mode 100644 TravelCompany/TravelCompanyDatabaseImplement/Implements/GuarantorImplements/PlaceStorage.cs create mode 100644 TravelCompany/TravelCompanyDatabaseImplement/Implements/GuarantorImplements/TripStorage.cs create mode 100644 TravelCompany/TravelCompanyDatabaseImplement/Models/GuarantorModels/Guarantor.cs create mode 100644 TravelCompany/TravelCompanyDatabaseImplement/Models/GuarantorModels/Guide.cs create mode 100644 TravelCompany/TravelCompanyDatabaseImplement/Models/GuarantorModels/Place.cs create mode 100644 TravelCompany/TravelCompanyDatabaseImplement/Models/GuarantorModels/Trip.cs create mode 100644 TravelCompany/TravelCompanyDatabaseImplement/TravelCompanyDatabase.cs diff --git a/TravelCompany/TravelCompanyDatabaseImplement/Implements/GuarantorImplements/GuarantorStorage.cs b/TravelCompany/TravelCompanyDatabaseImplement/Implements/GuarantorImplements/GuarantorStorage.cs new file mode 100644 index 0000000..7f49d29 --- /dev/null +++ b/TravelCompany/TravelCompanyDatabaseImplement/Implements/GuarantorImplements/GuarantorStorage.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace TravelCompanyDatabaseImplement.Implements.GuarantorImplements +{ + internal class GuarantorStorage + { + } +} diff --git a/TravelCompany/TravelCompanyDatabaseImplement/Implements/GuarantorImplements/GuideStorage.cs b/TravelCompany/TravelCompanyDatabaseImplement/Implements/GuarantorImplements/GuideStorage.cs new file mode 100644 index 0000000..28d2dda --- /dev/null +++ b/TravelCompany/TravelCompanyDatabaseImplement/Implements/GuarantorImplements/GuideStorage.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace TravelCompanyDatabaseImplement.Implements.GuarantorImplements +{ + internal class GuideStorage + { + } +} diff --git a/TravelCompany/TravelCompanyDatabaseImplement/Implements/GuarantorImplements/PlaceStorage.cs b/TravelCompany/TravelCompanyDatabaseImplement/Implements/GuarantorImplements/PlaceStorage.cs new file mode 100644 index 0000000..d666d47 --- /dev/null +++ b/TravelCompany/TravelCompanyDatabaseImplement/Implements/GuarantorImplements/PlaceStorage.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace TravelCompanyDatabaseImplement.Implements.GuarantorImplements +{ + internal class PlaceStorage + { + } +} diff --git a/TravelCompany/TravelCompanyDatabaseImplement/Implements/GuarantorImplements/TripStorage.cs b/TravelCompany/TravelCompanyDatabaseImplement/Implements/GuarantorImplements/TripStorage.cs new file mode 100644 index 0000000..184d100 --- /dev/null +++ b/TravelCompany/TravelCompanyDatabaseImplement/Implements/GuarantorImplements/TripStorage.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TravelCompanyContracts.BindingModels.Guarantor; +using TravelCompanyContracts.SearchModels.Guarantor; +using TravelCompanyContracts.StoragesModels.Guarantor; +using TravelCompanyContracts.ViewModels.Guarantor.ViewModels; +using TravelCompanyDatabaseImplement.Models.GuarantorModels; + +namespace TravelCompanyDatabaseImplement.Implements.GuarantorImplements +{ + internal class TripStorage + { + + } +} diff --git a/TravelCompany/TravelCompanyDatabaseImplement/Models/GuarantorModels/Guarantor.cs b/TravelCompany/TravelCompanyDatabaseImplement/Models/GuarantorModels/Guarantor.cs new file mode 100644 index 0000000..5c782a5 --- /dev/null +++ b/TravelCompany/TravelCompanyDatabaseImplement/Models/GuarantorModels/Guarantor.cs @@ -0,0 +1,78 @@ +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; +using TravelCompanyContracts.BindingModels.Guarantor; +using TravelCompanyContracts.ViewModels.Guarantor.ViewModels; +using TravelCompanyDataModels.Models.Guarantor; + +namespace TravelCompanyDatabaseImplement.Models.GuarantorModels +{ + public class Guarantor : IGuarantorModel + { + public int Id { get; set; } + + [Required] + public string Name { get; set; } = string.Empty; + + [Required] + public string Surname { get; set; } = string.Empty; + + [Required] + public string Patronymic { get; set; } = string.Empty; + + [Required] + public string Login { get; set; } = string.Empty; + + [Required] + public string Password { get; set; } = string.Empty; + + [Required] + public string Email { get; set; } = string.Empty; + + [Required] + public string MobilePhone { get; set; } = string.Empty; + + //[ForeignKey("GuarantorId")] + //public virtual List<> { get; set; } = new(); + + public GuarantorViewModel GetViewModel => new() + { + Id = Id, + Name = Name, + Surname = Surname, + Patronymic = Patronymic, + Login = Login, + Password = Password, + Email = Email, + MobilePhone = MobilePhone + }; + + public static Guarantor Create(GuarantorBindingModel model) + { + return new Guarantor() + { + Id = model.Id, + Name = model.Name, + Surname = model.Surname, + Patronymic = model.Patronymic, + Email = model.Email, + Password = model.Password, + MobilePhone = model.MobilePhone, + }; + } + + public void Update(GuarantorBindingModel model) + { + Name = model.Name; + Surname = model.Surname; + Patronymic = model.Patronymic; + Email = model.Email; + Password = model.Password; + MobilePhone = model.MobilePhone; + } + } +} diff --git a/TravelCompany/TravelCompanyDatabaseImplement/Models/GuarantorModels/Guide.cs b/TravelCompany/TravelCompanyDatabaseImplement/Models/GuarantorModels/Guide.cs new file mode 100644 index 0000000..dfb0e4f --- /dev/null +++ b/TravelCompany/TravelCompanyDatabaseImplement/Models/GuarantorModels/Guide.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace TravelCompanyDatabaseImplement.Models.GuarantorModels +{ + internal class Guide + { + } +} diff --git a/TravelCompany/TravelCompanyDatabaseImplement/Models/GuarantorModels/Place.cs b/TravelCompany/TravelCompanyDatabaseImplement/Models/GuarantorModels/Place.cs new file mode 100644 index 0000000..afa15d6 --- /dev/null +++ b/TravelCompany/TravelCompanyDatabaseImplement/Models/GuarantorModels/Place.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace TravelCompanyDatabaseImplement.Models.GuarantorModels +{ + internal class Place + { + } +} diff --git a/TravelCompany/TravelCompanyDatabaseImplement/Models/GuarantorModels/Trip.cs b/TravelCompany/TravelCompanyDatabaseImplement/Models/GuarantorModels/Trip.cs new file mode 100644 index 0000000..32f27d8 --- /dev/null +++ b/TravelCompany/TravelCompanyDatabaseImplement/Models/GuarantorModels/Trip.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace TravelCompanyDatabaseImplement.Models.GuarantorModels +{ + internal class Trip + { + } +} diff --git a/TravelCompany/TravelCompanyDatabaseImplement/TravelCompanyDatabase.cs b/TravelCompany/TravelCompanyDatabaseImplement/TravelCompanyDatabase.cs new file mode 100644 index 0000000..ac6a948 --- /dev/null +++ b/TravelCompany/TravelCompanyDatabaseImplement/TravelCompanyDatabase.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TravelCompanyDatabaseImplement.Models.ContractorModels; +using TravelCompanyDatabaseImplement.Models.GuarantorModels; +using Microsoft.EntityFrameworkCore; +using System.Security.Principal; + + +namespace TravelCompanyDatabaseImplement +{ + public class TravelCompanyDatabase : DbContext + { + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + if (optionsBuilder.IsConfigured == false) + { + optionsBuilder.UseSqlServer(@"Data Source=\SQLEXPRESS;Initial Catalog=TravelCompanyDataBase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True"); + } + base.OnConfiguring(optionsBuilder); + } + public virtual DbSet Accounts { set; get; } + + public virtual DbSet Cards { set; get; } + + public virtual DbSet Cashiers { set; get; } + + public virtual DbSet CashWithdrawals { set; get; } + + public virtual DbSet Guarantors { set; get; } + + public virtual DbSet Debitings { set; get; } + + public virtual DbSet Creditings { set; get; } + + public virtual DbSet MoneyTransfers { set; get; } + } +} diff --git a/TravelCompany/TravelCompanyDatabaseImplement/TravelCompanyDatabaseImplement.csproj b/TravelCompany/TravelCompanyDatabaseImplement/TravelCompanyDatabaseImplement.csproj index 4dcb2ce..51e81d3 100644 --- a/TravelCompany/TravelCompanyDatabaseImplement/TravelCompanyDatabaseImplement.csproj +++ b/TravelCompany/TravelCompanyDatabaseImplement/TravelCompanyDatabaseImplement.csproj @@ -7,8 +7,12 @@ - - + + + + + +