bd proccess

This commit is contained in:
platoff aeeee 2024-04-29 21:30:38 +04:00
parent 0700b2cc3d
commit a39601fb5d
10 changed files with 214 additions and 2 deletions

View File

@ -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
{
}
}

View File

@ -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
{
}
}

View File

@ -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
{
}
}

View File

@ -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
{
}
}

View File

@ -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;
}
}
}

View File

@ -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
{
}
}

View File

@ -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
{
}
}

View File

@ -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
{
}
}

View File

@ -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<Account> Accounts { set; get; }
public virtual DbSet<Card> Cards { set; get; }
public virtual DbSet<Cashier> Cashiers { set; get; }
public virtual DbSet<CashWithdrawal> CashWithdrawals { set; get; }
public virtual DbSet<Guarantor> Guarantors { set; get; }
public virtual DbSet<Debiting> Debitings { set; get; }
public virtual DbSet<Crediting> Creditings { set; get; }
public virtual DbSet<MoneyTransfer> MoneyTransfers { set; get; }
}
}

View File

@ -7,8 +7,12 @@
</PropertyGroup>
<ItemGroup>
<Folder Include="Implements\" />
<Folder Include="Models\" />
<Folder Include="Implements\ContractorImplements\" />
<Folder Include="Models\ContractorModels\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.17" />
</ItemGroup>
<ItemGroup>