Подключение БД и загрузка классов-сущностей
This commit is contained in:
parent
f053f70389
commit
5c660c6a9c
@ -13,7 +13,7 @@ namespace Contracts.BindingModels
|
||||
|
||||
public int Tonnage { get; set; }
|
||||
|
||||
public int StatusId { get; set; }
|
||||
public int? StatusId { get; set; }
|
||||
|
||||
public string StatusTitle { get; set; } = string.Empty;
|
||||
|
||||
|
@ -11,7 +11,7 @@ namespace Contracts.BindingModels
|
||||
{
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
public int StatusId {get; set; }
|
||||
public int? StatusId {get; set; }
|
||||
|
||||
public string StatusTitle { get; set; } = string.Empty;
|
||||
|
||||
|
@ -13,7 +13,7 @@ namespace Contracts.BindingModels
|
||||
|
||||
public string Phone { get; set; } = string.Empty;
|
||||
|
||||
public int StatusId { get; set; }
|
||||
public int? StatusId { get; set; }
|
||||
|
||||
public string StatusTitle { get; set; } = string.Empty;
|
||||
|
||||
|
@ -9,9 +9,9 @@ namespace Contracts.BindingModels
|
||||
{
|
||||
public class RouteBM : IRoute
|
||||
{
|
||||
public int PlaceStart { get; set; }
|
||||
public int? PlaceStart { get; set; }
|
||||
|
||||
public int PlaceEnd { get; set; }
|
||||
public int? PlaceEnd { get; set; }
|
||||
|
||||
public int Length { get; set; }
|
||||
|
||||
|
@ -9,23 +9,23 @@ namespace Contracts.BindingModels
|
||||
{
|
||||
public class VoyageBM : IVoyage
|
||||
{
|
||||
public int CarId { get; set; }
|
||||
public int? CarId { get; set; }
|
||||
|
||||
public string CarName { get; set; } = string.Empty;
|
||||
|
||||
public int HumanId { get; set; }
|
||||
public int? HumanId { get; set; }
|
||||
|
||||
public string HumanName { get; set; } = string.Empty;
|
||||
|
||||
public int CompanyId { get; set; }
|
||||
public int? CompanyId { get; set; }
|
||||
|
||||
public string CompanyName { get; set; } = string.Empty;
|
||||
|
||||
public int RouteId { get; set; }
|
||||
public int? RouteId { get; set; }
|
||||
|
||||
public DateTime DateStart { get; set; }
|
||||
public DateOnly? DateStart { get; set; }
|
||||
|
||||
public DateTime DateEnd { get; set; }
|
||||
public DateOnly? DateEnd { get; set; }
|
||||
|
||||
public int Id { get; set; }
|
||||
}
|
||||
|
@ -11,5 +11,6 @@ namespace Contracts.SearchModel
|
||||
public string? Model { get; set; }
|
||||
public int? Id { get; set; }
|
||||
public int? StatusId { get; set; }
|
||||
public int? Tonnage { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ namespace Contracts.Storage
|
||||
public interface IStatusStorage
|
||||
{
|
||||
List<StatusVM> GetFullList();
|
||||
List<StatusVM> GetFilteredList(StatusSM model);
|
||||
StatusVM? GetElement(StatusSM model);
|
||||
StatusVM? Insert(StatusBM model);
|
||||
StatusVM? Update(StatusBM model);
|
||||
|
@ -15,7 +15,7 @@ namespace Contracts.Storage
|
||||
List<VoyageVM> GetFilteredList(VoyageSM model);
|
||||
VoyageVM? GetElement(VoyageSM model);
|
||||
VoyageVM? Insert(VoyageBM model);
|
||||
VoyageVM? Update(VoyageBM model);
|
||||
|
||||
VoyageVM? Delete(VoyageBM model);
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ namespace Contracts.ViewModels
|
||||
[DisplayName("Грузоподъемность")]
|
||||
public int Tonnage { get; set; }
|
||||
|
||||
public int StatusId { get; set; }
|
||||
public int? StatusId { get; set; }
|
||||
[DisplayName("Статус")]
|
||||
public string StatusTitle { get; set; } = string.Empty;
|
||||
[DisplayName("Номер")]
|
||||
|
@ -13,7 +13,7 @@ namespace Contracts.ViewModels
|
||||
[DisplayName("Название")]
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
public int StatusId { get; set; }
|
||||
public int? StatusId { get; set; }
|
||||
[DisplayName("Статус")]
|
||||
public string StatusTitle { get; set; } = string.Empty;
|
||||
[DisplayName("Номер")]
|
||||
|
@ -15,7 +15,7 @@ namespace Contracts.ViewModels
|
||||
[DisplayName("Телефон")]
|
||||
public string Phone { get; set; } = string.Empty;
|
||||
|
||||
public int StatusId { get; set; }
|
||||
public int? StatusId { get; set; }
|
||||
[DisplayName("Статус")]
|
||||
public string StatusTitle { get; set; } = string.Empty;
|
||||
[DisplayName("Номер")]
|
||||
|
@ -10,9 +10,9 @@ namespace Contracts.ViewModels
|
||||
{
|
||||
public class RouteVM : IRoute
|
||||
{
|
||||
public int PlaceStart { get; set; }
|
||||
public int? PlaceStart { get; set; }
|
||||
|
||||
public int PlaceEnd { get; set; }
|
||||
public int? PlaceEnd { get; set; }
|
||||
|
||||
public int Length { get; set; }
|
||||
[DisplayName("Название")]
|
||||
|
@ -10,23 +10,23 @@ namespace Contracts.ViewModels
|
||||
{
|
||||
public class VoyageVM : IVoyage
|
||||
{
|
||||
public int CarId { get; set; }
|
||||
public int? CarId { get; set; }
|
||||
[DisplayName("Машина")]
|
||||
public string CarName { get; set; } = string.Empty;
|
||||
|
||||
public int HumanId { get; set; }
|
||||
public int? HumanId { get; set; }
|
||||
[DisplayName("Водитель")]
|
||||
public string HumanName { get; set; } = string.Empty;
|
||||
|
||||
public int CompanyId { get; set; }
|
||||
public int? CompanyId { get; set; }
|
||||
[DisplayName("Заказчик")]
|
||||
public string CompanyName { get; set; } = string.Empty;
|
||||
|
||||
public int RouteId { get; set; }
|
||||
public int? RouteId { get; set; }
|
||||
[DisplayName("Дата выезда")]
|
||||
public DateTime DateStart { get; set; }
|
||||
public DateOnly? DateStart { get; set; }
|
||||
[DisplayName("Срок")]
|
||||
public DateTime DateEnd { get; set; }
|
||||
public DateOnly? DateEnd { get; set; }
|
||||
[DisplayName("Номер")]
|
||||
public int Id { get; set; }
|
||||
}
|
||||
|
69
Subd/DataBase/Car.cs
Normal file
69
Subd/DataBase/Car.cs
Normal file
@ -0,0 +1,69 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.ViewModels;
|
||||
using DataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace DataBase;
|
||||
|
||||
/// <summary>
|
||||
/// Таблица машин
|
||||
/// </summary>
|
||||
public partial class Car : ICar
|
||||
{
|
||||
/// <summary>
|
||||
/// Айди машины
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Модель машины
|
||||
/// </summary>
|
||||
public string Model { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Грузоподъемность
|
||||
/// </summary>
|
||||
public int Tonnage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Статус машины
|
||||
/// </summary>
|
||||
public int? StatusId { get; set; }
|
||||
|
||||
public virtual Status? Status { get; set; }
|
||||
|
||||
public virtual ICollection<Voyage> Voyages { get; set; } = new List<Voyage>();
|
||||
|
||||
public string StatusTitle { get; set; } =string.Empty;
|
||||
|
||||
public static Car Create(LogisticContext context, CarBM model)
|
||||
{
|
||||
return new Car()
|
||||
{
|
||||
Id = model.Id,
|
||||
Model = model.Model,
|
||||
Tonnage = model.Tonnage,
|
||||
StatusId= model.StatusId,
|
||||
StatusTitle = model.StatusTitle
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(CarBM model)
|
||||
{
|
||||
Model = model.Model;
|
||||
Tonnage = model.Tonnage;
|
||||
StatusTitle = model.StatusTitle;
|
||||
StatusId = model.StatusId;
|
||||
}
|
||||
|
||||
public CarVM GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Model = Model,
|
||||
Tonnage = Tonnage,
|
||||
StatusId = StatusId ,
|
||||
StatusTitle=StatusTitle,
|
||||
};
|
||||
}
|
60
Subd/DataBase/Company.cs
Normal file
60
Subd/DataBase/Company.cs
Normal file
@ -0,0 +1,60 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.ViewModels;
|
||||
using DataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DataBase;
|
||||
|
||||
/// <summary>
|
||||
/// Таблица компаний-заказчиков
|
||||
/// </summary>
|
||||
public partial class Company : ICompany
|
||||
{
|
||||
/// <summary>
|
||||
/// Айди компании
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Наимнование компании
|
||||
/// </summary>
|
||||
public string Title { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Статус компании
|
||||
/// </summary>
|
||||
public int? StatusId { get; set; }
|
||||
|
||||
public virtual Status? Status { get; set; }
|
||||
|
||||
public virtual ICollection<Voyage> Voyages { get; set; } = new List<Voyage>();
|
||||
|
||||
public string StatusTitle { get; set; } = string.Empty;
|
||||
public static Company Create(LogisticContext context, CompanyBM model)
|
||||
{
|
||||
return new Company()
|
||||
{
|
||||
Id = model.Id,
|
||||
Title = model.Title,
|
||||
StatusId = model.StatusId,
|
||||
StatusTitle=model.StatusTitle
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(CompanyBM model)
|
||||
{
|
||||
Title = model.Title;
|
||||
StatusTitle = model.StatusTitle;
|
||||
StatusId = model.StatusId;
|
||||
}
|
||||
|
||||
public CompanyVM GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Title = Title,
|
||||
StatusId = StatusId,
|
||||
StatusTitle = StatusTitle
|
||||
};
|
||||
}
|
23
Subd/DataBase/DataBase.csproj
Normal file
23
Subd/DataBase/DataBase.csproj
Normal file
@ -0,0 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.5">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Contracts\Contracts.csproj" />
|
||||
<ProjectReference Include="..\Subd\DataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
68
Subd/DataBase/Human.cs
Normal file
68
Subd/DataBase/Human.cs
Normal file
@ -0,0 +1,68 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.SearchModel;
|
||||
using Contracts.ViewModels;
|
||||
using DataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DataBase;
|
||||
|
||||
/// <summary>
|
||||
/// Таблица водителей
|
||||
/// </summary>
|
||||
public partial class Human : IHuman
|
||||
{
|
||||
/// <summary>
|
||||
/// Айди человека
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ФИО водителя
|
||||
/// </summary>
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Телефон водителя
|
||||
/// </summary>
|
||||
public string Phone { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Статус водителя
|
||||
/// </summary>
|
||||
public int? StatusId { get; set; }
|
||||
|
||||
public virtual Status? Status { get; set; }
|
||||
|
||||
public virtual ICollection<Voyage> Voyages { get; set; } = new List<Voyage>();
|
||||
|
||||
public string StatusTitle { get; set; } = string.Empty;
|
||||
public static Human Create(LogisticContext context, HumanBM model)
|
||||
{
|
||||
return new Human()
|
||||
{
|
||||
Id = model.Id,
|
||||
Name = model.Name,
|
||||
Phone = model.Phone,
|
||||
StatusId = model.StatusId,
|
||||
StatusTitle = model.StatusTitle
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(HumanBM model)
|
||||
{
|
||||
Name = model.Name;
|
||||
Phone = model.Phone;
|
||||
StatusTitle = model.StatusTitle;
|
||||
StatusId = model.StatusId;
|
||||
}
|
||||
|
||||
public HumanVM GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
Phone = Phone,
|
||||
StatusId = StatusId,
|
||||
StatusTitle = StatusTitle
|
||||
};
|
||||
}
|
108
Subd/DataBase/Implements/CarStorage.cs
Normal file
108
Subd/DataBase/Implements/CarStorage.cs
Normal file
@ -0,0 +1,108 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.SearchModel;
|
||||
using Contracts.Storage;
|
||||
using Contracts.ViewModels;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataBase.Implements
|
||||
{
|
||||
public class CarStorage : ICarStorage
|
||||
{
|
||||
public List<CarVM> GetFullList()
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
return context.Cars.FromSqlRaw("Select * From Car")
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<CarVM> GetFilteredList(CarSM model)
|
||||
{
|
||||
if (!model.StatusId.HasValue && !model.Tonnage.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new LogisticContext();
|
||||
if(model.StatusId.HasValue)
|
||||
return context.Cars
|
||||
.FromSqlRaw("Select * FROM Car WHERE StatusId = {0}",model.StatusId)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
else
|
||||
return context.Cars
|
||||
.FromSqlRaw("Select * FROM Car WHERE Tonnage >= {0}", model.Tonnage)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public CarVM? GetElement(CarSM model)
|
||||
{
|
||||
if ( !model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new LogisticContext();
|
||||
return context.Cars
|
||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public CarVM? Insert(CarBM model)
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
var newCar = Car.Create(context, model);
|
||||
if (newCar == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Cars.Add(newCar);
|
||||
context.SaveChanges();
|
||||
return newCar.GetViewModel;
|
||||
}
|
||||
|
||||
public CarVM? Update(CarBM model)
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var car = context.Cars.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (car == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
car.Update(model);
|
||||
context.SaveChanges();
|
||||
transaction.Commit();
|
||||
return car.GetViewModel;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public CarVM? Delete(CarBM model)
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
var element = context.Cars
|
||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Cars.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
102
Subd/DataBase/Implements/CompanyStorage.cs
Normal file
102
Subd/DataBase/Implements/CompanyStorage.cs
Normal file
@ -0,0 +1,102 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.SearchModel;
|
||||
using Contracts.Storage;
|
||||
using Contracts.ViewModels;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataBase.Implements
|
||||
{
|
||||
public class CompanyStorage : ICompanyStorage
|
||||
{
|
||||
public List<CompanyVM> GetFullList()
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
return context.Companies.FromSqlRaw("Select * From Company")
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<CompanyVM> GetFilteredList(CompanySM model)
|
||||
{
|
||||
if (!model.StatusId.HasValue )
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new LogisticContext();
|
||||
return context.Companies
|
||||
.FromSqlRaw("Select * FROM Company WHERE StatusId = {0}", model.StatusId)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
|
||||
}
|
||||
|
||||
public CompanyVM? GetElement(CompanySM model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new LogisticContext();
|
||||
return context.Companies
|
||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public CompanyVM? Insert(CompanyBM model)
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
var newCompany = Company.Create(context, model);
|
||||
if (newCompany == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Companies.Add(newCompany);
|
||||
context.SaveChanges();
|
||||
return newCompany.GetViewModel;
|
||||
}
|
||||
|
||||
public CompanyVM? Update(CompanyBM model)
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var company = context.Companies.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (company == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
company.Update(model);
|
||||
context.SaveChanges();
|
||||
transaction.Commit();
|
||||
return company.GetViewModel;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public CompanyVM? Delete(CompanyBM model)
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
var element = context.Companies
|
||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Companies.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
102
Subd/DataBase/Implements/HumanStorage.cs
Normal file
102
Subd/DataBase/Implements/HumanStorage.cs
Normal file
@ -0,0 +1,102 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.SearchModel;
|
||||
using Contracts.Storage;
|
||||
using Contracts.ViewModels;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataBase.Implements
|
||||
{
|
||||
public class HumanStorage : IHumanStorage
|
||||
{
|
||||
public List<HumanVM> GetFullList()
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
return context.Humans.FromSqlRaw("Select * From Human")
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<HumanVM> GetFilteredList(HumanSM model)
|
||||
{
|
||||
if (!model.StatusId.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new LogisticContext();
|
||||
return context.Humans
|
||||
.FromSqlRaw("Select * FROM Human WHERE StatusId = {0}", model.StatusId)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
|
||||
}
|
||||
|
||||
public HumanVM? GetElement(HumanSM model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new LogisticContext();
|
||||
return context.Humans
|
||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public HumanVM? Insert(HumanBM model)
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
var newHuman = Human.Create(context, model);
|
||||
if (newHuman == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Humans.Add(newHuman);
|
||||
context.SaveChanges();
|
||||
return newHuman.GetViewModel;
|
||||
}
|
||||
|
||||
public HumanVM? Update(HumanBM model)
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var human = context.Humans.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (human == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
human.Update(model);
|
||||
context.SaveChanges();
|
||||
transaction.Commit();
|
||||
return human.GetViewModel;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public HumanVM? Delete(HumanBM model)
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
var element = context.Humans
|
||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Humans.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
102
Subd/DataBase/Implements/PlaceStorage.cs
Normal file
102
Subd/DataBase/Implements/PlaceStorage.cs
Normal file
@ -0,0 +1,102 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.SearchModel;
|
||||
using Contracts.Storage;
|
||||
using Contracts.ViewModels;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataBase.Implements
|
||||
{
|
||||
public class PlaceStorage : IPlaceStorage
|
||||
{
|
||||
public List<PlaceVM> GetFullList()
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
return context.Places.FromSqlRaw("Select * From Place")
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<PlaceVM> GetFilteredList(PlaceSM model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Title))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new LogisticContext();
|
||||
return context.Places
|
||||
.FromSqlRaw("Select * FROM Place WHERE LIKE %{0}%", model.Title)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
|
||||
}
|
||||
|
||||
public PlaceVM? GetElement(PlaceSM model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new LogisticContext();
|
||||
return context.Places
|
||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public PlaceVM? Insert(PlaceBM model)
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
var newPlace = Place.Create(context, model);
|
||||
if (newPlace == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Places.Add(newPlace);
|
||||
context.SaveChanges();
|
||||
return newPlace.GetViewModel;
|
||||
}
|
||||
|
||||
public PlaceVM? Update(PlaceBM model)
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var place = context.Places.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (place == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
place.Update(model);
|
||||
context.SaveChanges();
|
||||
transaction.Commit();
|
||||
return place.GetViewModel;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public PlaceVM? Delete(PlaceBM model)
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
var element = context.Places
|
||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Places.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
102
Subd/DataBase/Implements/RouteStorage.cs
Normal file
102
Subd/DataBase/Implements/RouteStorage.cs
Normal file
@ -0,0 +1,102 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.SearchModel;
|
||||
using Contracts.Storage;
|
||||
using Contracts.ViewModels;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataBase.Implements
|
||||
{
|
||||
public class RouteStorage : IRouteStorage
|
||||
{
|
||||
public List<RouteVM> GetFullList()
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
return context.Routes.FromSqlRaw("Select * From Route")
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<RouteVM> GetFilteredList(RouteSM model)
|
||||
{
|
||||
if (model.Length.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new LogisticContext();
|
||||
return context.Routes
|
||||
.FromSqlRaw("Select * FROM Route WHERE Length <= {0}", model.Length)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
|
||||
}
|
||||
|
||||
public RouteVM? GetElement(RouteSM model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new LogisticContext();
|
||||
return context.Routes
|
||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public RouteVM? Insert(RouteBM model)
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
var newRoute = Route.Create(context, model);
|
||||
if (newRoute == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Routes.Add(newRoute);
|
||||
context.SaveChanges();
|
||||
return newRoute.GetViewModel;
|
||||
}
|
||||
|
||||
public RouteVM? Update(RouteBM model)
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var route = context.Routes.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (route == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
route.Update(model);
|
||||
context.SaveChanges();
|
||||
transaction.Commit();
|
||||
return route.GetViewModel;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public RouteVM? Delete(RouteBM model)
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
var element = context.Routes
|
||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Routes.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
89
Subd/DataBase/Implements/StatusStorage.cs
Normal file
89
Subd/DataBase/Implements/StatusStorage.cs
Normal file
@ -0,0 +1,89 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.SearchModel;
|
||||
using Contracts.Storage;
|
||||
using Contracts.ViewModels;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataBase.Implements
|
||||
{
|
||||
public class StatusStorage : IStatusStorage
|
||||
{
|
||||
public List<StatusVM> GetFullList()
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
return context.Statuses.FromSqlRaw("Select * From Status")
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public StatusVM? GetElement(StatusSM model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new LogisticContext();
|
||||
return context.Statuses
|
||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public StatusVM? Insert(StatusBM model)
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
var newStatus = Status.Create(context, model);
|
||||
if (newStatus == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Statuses.Add(newStatus);
|
||||
context.SaveChanges();
|
||||
return newStatus.GetViewModel;
|
||||
}
|
||||
|
||||
public StatusVM? Update(StatusBM model)
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var status = context.Statuses.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (status == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
status.Update(model);
|
||||
context.SaveChanges();
|
||||
transaction.Commit();
|
||||
return status.GetViewModel;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public StatusVM? Delete(StatusBM model)
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
var element = context.Statuses
|
||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Statuses.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
81
Subd/DataBase/Implements/VoyageStorage.cs
Normal file
81
Subd/DataBase/Implements/VoyageStorage.cs
Normal file
@ -0,0 +1,81 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.SearchModel;
|
||||
using Contracts.Storage;
|
||||
using Contracts.ViewModels;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataBase.Implements
|
||||
{
|
||||
public class VoyageStorage : IVoyageStorage
|
||||
{
|
||||
public List<VoyageVM> GetFullList()
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
return context.Voyages.FromSqlRaw("Select * From Voyage")
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<VoyageVM> GetFilteredList(VoyageSM model)
|
||||
{
|
||||
if (!model.DateStart.HasValue || !model.DateEnd.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new LogisticContext();
|
||||
return context.Voyages
|
||||
.FromSqlRaw("Select * FROM Voyage WHERE DateStart > {0} AND DateEnd < {1}", model.DateStart,model.DateEnd)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
|
||||
}
|
||||
|
||||
public VoyageVM? GetElement(VoyageSM model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new LogisticContext();
|
||||
return context.Voyages
|
||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public VoyageVM? Insert(VoyageBM model)
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
var newVoyage = Voyage.Create(context, model);
|
||||
if (newVoyage == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
context.Voyages.Add(newVoyage);
|
||||
context.SaveChanges();
|
||||
return newVoyage.GetViewModel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public VoyageVM? Delete(VoyageBM model)
|
||||
{
|
||||
using var context = new LogisticContext();
|
||||
var element = context.Voyages
|
||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Voyages.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
247
Subd/DataBase/LogisticContext.cs
Normal file
247
Subd/DataBase/LogisticContext.cs
Normal file
@ -0,0 +1,247 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DataBase;
|
||||
|
||||
public partial class LogisticContext : DbContext
|
||||
{
|
||||
public LogisticContext()
|
||||
{
|
||||
}
|
||||
|
||||
public LogisticContext(DbContextOptions<LogisticContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual DbSet<Car> Cars { get; set; }
|
||||
|
||||
public virtual DbSet<Company> Companies { get; set; }
|
||||
|
||||
public virtual DbSet<Human> Humans { get; set; }
|
||||
|
||||
public virtual DbSet<Place> Places { get; set; }
|
||||
|
||||
public virtual DbSet<Route> Routes { get; set; }
|
||||
|
||||
public virtual DbSet<Status> Statuses { get; set; }
|
||||
|
||||
public virtual DbSet<Voyage> Voyages { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
|
||||
=> optionsBuilder.UseNpgsql("Host=192.168.56.101;Port=5432;Database=logistic;Username=postgres;Password=postgres");
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Car>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("car_pkey");
|
||||
|
||||
entity.ToTable("car", tb => tb.HasComment("Таблица машин"));
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasDefaultValueSql("nextval('s3'::regclass)")
|
||||
.HasComment("Айди машины")
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Model)
|
||||
.HasMaxLength(100)
|
||||
.HasDefaultValueSql("'car'::character varying")
|
||||
.HasComment("Модель машины")
|
||||
.HasColumnName("model");
|
||||
entity.Property(e => e.StatusId)
|
||||
.HasComment("Статус машины")
|
||||
.HasColumnName("status_id");
|
||||
entity.Property(e => e.Tonnage)
|
||||
.HasComment("Грузоподъемность")
|
||||
.HasColumnName("tonnage");
|
||||
|
||||
entity.HasOne(d => d.Status).WithMany(p => p.Cars)
|
||||
.HasForeignKey(d => d.StatusId)
|
||||
.OnDelete(DeleteBehavior.SetNull)
|
||||
.HasConstraintName("car_status_id_fkey");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Company>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("company_pkey");
|
||||
|
||||
entity.ToTable("company", tb => tb.HasComment("Таблица компаний-заказчиков"));
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasDefaultValueSql("nextval('s2'::regclass)")
|
||||
.HasComment("Айди компании")
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.StatusId)
|
||||
.HasComment("Статус компании")
|
||||
.HasColumnName("status_id");
|
||||
entity.Property(e => e.Title)
|
||||
.HasMaxLength(100)
|
||||
.HasDefaultValueSql("'company'::character varying")
|
||||
.HasComment("Наимнование компании")
|
||||
.HasColumnName("title");
|
||||
|
||||
entity.HasOne(d => d.Status).WithMany(p => p.Companies)
|
||||
.HasForeignKey(d => d.StatusId)
|
||||
.OnDelete(DeleteBehavior.SetNull)
|
||||
.HasConstraintName("company_status_id_fkey");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Human>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("human_pkey");
|
||||
|
||||
entity.ToTable("human", tb => tb.HasComment("Таблица водителей"));
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasDefaultValueSql("nextval('s4'::regclass)")
|
||||
.HasComment("Айди человека")
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Name)
|
||||
.HasMaxLength(100)
|
||||
.HasDefaultValueSql("'name'::character varying")
|
||||
.HasComment("ФИО водителя")
|
||||
.HasColumnName("name");
|
||||
entity.Property(e => e.Phone)
|
||||
.HasMaxLength(12)
|
||||
.HasDefaultValueSql("'N'::character varying")
|
||||
.HasComment("Телефон водителя")
|
||||
.HasColumnName("phone");
|
||||
entity.Property(e => e.StatusId)
|
||||
.HasComment("Статус водителя")
|
||||
.HasColumnName("status_id");
|
||||
|
||||
entity.HasOne(d => d.Status).WithMany(p => p.Humans)
|
||||
.HasForeignKey(d => d.StatusId)
|
||||
.OnDelete(DeleteBehavior.SetNull)
|
||||
.HasConstraintName("human_status_id_fkey");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Place>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("place_pkey");
|
||||
|
||||
entity.ToTable("place", tb => tb.HasComment("Таблица мест"));
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasDefaultValueSql("nextval('s5'::regclass)")
|
||||
.HasComment("Айди места")
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Title)
|
||||
.HasMaxLength(100)
|
||||
.HasDefaultValueSql("'place'::character varying")
|
||||
.HasComment("Наименование места")
|
||||
.HasColumnName("title");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Route>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("route_pkey");
|
||||
|
||||
entity.ToTable("route", tb => tb.HasComment("Таблица маршрутов"));
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasDefaultValueSql("nextval('s6'::regclass)")
|
||||
.HasComment("Айди маршрутта")
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Length)
|
||||
.HasComment("Протяженность маршрута")
|
||||
.HasColumnName("length");
|
||||
entity.Property(e => e.PlaceEnd)
|
||||
.HasComment("Места отправки")
|
||||
.HasColumnName("place_end");
|
||||
entity.Property(e => e.PlaceStart)
|
||||
.HasComment("Места прибытия")
|
||||
.HasColumnName("place_start");
|
||||
|
||||
entity.HasOne(d => d.PlaceEndNavigation).WithMany(p => p.RoutePlaceEndNavigations)
|
||||
.HasForeignKey(d => d.PlaceEnd)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("route_placeend_fkey");
|
||||
|
||||
entity.HasOne(d => d.PlaceStartNavigation).WithMany(p => p.RoutePlaceStartNavigations)
|
||||
.HasForeignKey(d => d.PlaceStart)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("route_placestart_fkey");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Status>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("status_pkey");
|
||||
|
||||
entity.ToTable("status", tb => tb.HasComment("Таблица статусов"));
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasDefaultValueSql("nextval('s1'::regclass)")
|
||||
.HasComment("Айди статуса")
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Title)
|
||||
.HasMaxLength(20)
|
||||
.HasDefaultValueSql("'status'::character varying")
|
||||
.HasComment("Название статуса")
|
||||
.HasColumnName("title");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Voyage>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("voyage_pkey");
|
||||
|
||||
entity.ToTable("voyage", tb => tb.HasComment("Таблица рейсов"));
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasDefaultValueSql("nextval('s7'::regclass)")
|
||||
.HasComment("Айди рейса")
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.CarId)
|
||||
.HasComment("Машина для рейса")
|
||||
.HasColumnName("car_id");
|
||||
entity.Property(e => e.CompanyId)
|
||||
.HasComment("Компания, заказавшая рейс")
|
||||
.HasColumnName("company_id");
|
||||
entity.Property(e => e.DateEnd)
|
||||
.HasComment("Дедлайн")
|
||||
.HasColumnName("date_end");
|
||||
entity.Property(e => e.DateStart)
|
||||
.HasComment("Дата отправки")
|
||||
.HasColumnName("date_start");
|
||||
entity.Property(e => e.HumanId)
|
||||
.HasComment("Водитель для рейса")
|
||||
.HasColumnName("human_id");
|
||||
entity.Property(e => e.RouteId)
|
||||
.HasComment("Маршрут рейса")
|
||||
.HasColumnName("route_id");
|
||||
|
||||
entity.HasOne(d => d.Car).WithMany(p => p.Voyages)
|
||||
.HasForeignKey(d => d.CarId)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("voyage_car_id_fkey");
|
||||
|
||||
entity.HasOne(d => d.Company).WithMany(p => p.Voyages)
|
||||
.HasForeignKey(d => d.CompanyId)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("voyage_company_id_fkey");
|
||||
|
||||
entity.HasOne(d => d.Human).WithMany(p => p.Voyages)
|
||||
.HasForeignKey(d => d.HumanId)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("voyage_human_id_fkey");
|
||||
|
||||
entity.HasOne(d => d.Route).WithMany(p => p.Voyages)
|
||||
.HasForeignKey(d => d.RouteId)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("voyage_route_id_fkey");
|
||||
});
|
||||
modelBuilder.HasSequence("s1");
|
||||
modelBuilder.HasSequence("s2");
|
||||
modelBuilder.HasSequence("s3");
|
||||
modelBuilder.HasSequence("s4");
|
||||
modelBuilder.HasSequence("s5");
|
||||
modelBuilder.HasSequence("s6");
|
||||
modelBuilder.HasSequence("s7");
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||
}
|
51
Subd/DataBase/Place.cs
Normal file
51
Subd/DataBase/Place.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.ViewModels;
|
||||
using DataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace DataBase;
|
||||
|
||||
/// <summary>
|
||||
/// Таблица мест
|
||||
/// </summary>
|
||||
public partial class Place : IPlace
|
||||
{
|
||||
/// <summary>
|
||||
/// Айди места
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Наименование места
|
||||
/// </summary>
|
||||
public string Title { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<Route> RoutePlaceEndNavigations { get; set; } = new List<Route>();
|
||||
|
||||
public virtual ICollection<Route> RoutePlaceStartNavigations { get; set; } = new List<Route>();
|
||||
public static Place Create(LogisticContext context, PlaceBM model)
|
||||
{
|
||||
return new Place()
|
||||
{
|
||||
Id = model.Id,
|
||||
Title = model.Title,
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(PlaceBM model)
|
||||
{
|
||||
Title = model.Title;
|
||||
|
||||
}
|
||||
|
||||
public PlaceVM GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Title = Title,
|
||||
|
||||
};
|
||||
}
|
70
Subd/DataBase/Route.cs
Normal file
70
Subd/DataBase/Route.cs
Normal file
@ -0,0 +1,70 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.ViewModels;
|
||||
using DataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DataBase;
|
||||
|
||||
/// <summary>
|
||||
/// Таблица маршрутов
|
||||
/// </summary>
|
||||
public partial class Route : IRoute
|
||||
{
|
||||
/// <summary>
|
||||
/// Айди маршрутта
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Протяженность маршрута
|
||||
/// </summary>
|
||||
public int Length { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Места прибытия
|
||||
/// </summary>
|
||||
public int? PlaceStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Места отправки
|
||||
/// </summary>
|
||||
public int? PlaceEnd { get; set; }
|
||||
|
||||
public virtual Place? PlaceEndNavigation { get; set; }
|
||||
|
||||
public virtual Place? PlaceStartNavigation { get; set; }
|
||||
|
||||
public virtual ICollection<Voyage> Voyages { get; set; } = new List<Voyage>();
|
||||
|
||||
public string Title { get; set; }=string.Empty;
|
||||
|
||||
public static Route Create(LogisticContext context, RouteBM model)
|
||||
{
|
||||
return new Route()
|
||||
{
|
||||
Id = model.Id,
|
||||
Title = model.Title,
|
||||
Length = model.Length,
|
||||
PlaceStart = model.PlaceStart,
|
||||
PlaceEnd = model.PlaceEnd,
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(RouteBM model)
|
||||
{
|
||||
Title = model.Title;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public RouteVM GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Title = Title,
|
||||
Length = Length,
|
||||
PlaceStart = PlaceStart,
|
||||
PlaceEnd = PlaceEnd,
|
||||
};
|
||||
}
|
52
Subd/DataBase/Status.cs
Normal file
52
Subd/DataBase/Status.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DataBase;
|
||||
|
||||
/// <summary>
|
||||
/// Таблица статусов
|
||||
/// </summary>
|
||||
public partial class Status
|
||||
{
|
||||
/// <summary>
|
||||
/// Айди статуса
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Название статуса
|
||||
/// </summary>
|
||||
public string? Title { get; set; } = string.Empty;
|
||||
|
||||
public virtual ICollection<Car> Cars { get; set; } = new List<Car>();
|
||||
|
||||
public virtual ICollection<Company> Companies { get; set; } = new List<Company>();
|
||||
|
||||
public virtual ICollection<Human> Humans { get; set; } = new List<Human>();
|
||||
public static Status Create(LogisticContext context, StatusBM model)
|
||||
{
|
||||
return new Status()
|
||||
{
|
||||
Id = model.Id,
|
||||
Title = model.Title,
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(StatusBM model)
|
||||
{
|
||||
Title = model.Title;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public StatusVM GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Title = Title,
|
||||
|
||||
};
|
||||
}
|
98
Subd/DataBase/Voyage.cs
Normal file
98
Subd/DataBase/Voyage.cs
Normal file
@ -0,0 +1,98 @@
|
||||
using Contracts.BindingModels;
|
||||
using Contracts.ViewModels;
|
||||
using DataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DataBase;
|
||||
|
||||
/// <summary>
|
||||
/// Таблица рейсов
|
||||
/// </summary>
|
||||
public partial class Voyage : IVoyage
|
||||
{
|
||||
/// <summary>
|
||||
/// Айди рейса
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Машина для рейса
|
||||
/// </summary>
|
||||
public int? CarId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Водитель для рейса
|
||||
/// </summary>
|
||||
public int? HumanId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Компания, заказавшая рейс
|
||||
/// </summary>
|
||||
public int? CompanyId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Маршрут рейса
|
||||
/// </summary>
|
||||
public int? RouteId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Дата отправки
|
||||
/// </summary>
|
||||
public DateOnly? DateStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Дедлайн
|
||||
/// </summary>
|
||||
public DateOnly? DateEnd { get; set; }
|
||||
|
||||
public virtual Car? Car { get; set; }
|
||||
|
||||
public virtual Company? Company { get; set; }
|
||||
|
||||
public virtual Human? Human { get; set; }
|
||||
|
||||
public virtual Route? Route { get; set; }
|
||||
|
||||
public string CarName { get; set; } = string.Empty;
|
||||
|
||||
public string HumanName { get; set; } = string.Empty;
|
||||
|
||||
public string CompanyName { get; set; } = string.Empty;
|
||||
public static Voyage Create(LogisticContext context, VoyageBM model)
|
||||
{
|
||||
return new Voyage()
|
||||
{
|
||||
Id = model.Id,
|
||||
CarId=model.CarId,
|
||||
HumanId=model.HumanId,
|
||||
CompanyId=model.CompanyId,
|
||||
RouteId=model.RouteId,
|
||||
DateStart=model.DateStart,
|
||||
DateEnd=model.DateEnd,
|
||||
CarName=model.CarName,
|
||||
HumanName=model.HumanName,
|
||||
CompanyName=model.CompanyName,
|
||||
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
public VoyageVM GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
CarId = CarId,
|
||||
HumanId = HumanId,
|
||||
CompanyId = CompanyId,
|
||||
RouteId = RouteId,
|
||||
DateStart = DateStart,
|
||||
DateEnd = DateEnd,
|
||||
CarName = CarName,
|
||||
HumanName = HumanName,
|
||||
CompanyName = CompanyName,
|
||||
|
||||
};
|
||||
}
|
39
Subd/Forms/Form1.Designer.cs
generated
Normal file
39
Subd/Forms/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,39 @@
|
||||
namespace Forms
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "Form1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
10
Subd/Forms/Form1.cs
Normal file
10
Subd/Forms/Form1.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace Forms
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
120
Subd/Forms/Form1.resx
Normal file
120
Subd/Forms/Form1.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
21
Subd/Forms/Forms.csproj
Normal file
21
Subd/Forms/Forms.csproj
Normal file
@ -0,0 +1,21 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.5">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
|
||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
35
Subd/Forms/Program.cs
Normal file
35
Subd/Forms/Program.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NLog.Extensions.Logging;
|
||||
using System;
|
||||
|
||||
namespace Forms
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
private static ServiceProvider? _serviceProvider;
|
||||
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
var services = new ServiceCollection();
|
||||
ConfigureServices(services);
|
||||
_serviceProvider = services.BuildServiceProvider();
|
||||
Application.Run(_serviceProvider.GetRequiredService<Form1>());
|
||||
}
|
||||
private static void ConfigureServices(ServiceCollection services)
|
||||
{
|
||||
services.AddLogging(option =>
|
||||
{
|
||||
option.SetMinimumLevel(LogLevel.Information);
|
||||
option.AddNLog("nlog.config");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -7,6 +7,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataModels", "Subd\DataMode
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contracts", "Contracts\Contracts.csproj", "{AB284C76-C880-4A90-8E6D-00A8ACCA531A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataBase", "DataBase\DataBase.csproj", "{1BD4BC13-350F-48B2-8A5D-55585620470B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Forms", "Forms\Forms.csproj", "{1901CFE4-7DA9-423E-A3A1-20A3444CC7F7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -21,6 +25,14 @@ Global
|
||||
{AB284C76-C880-4A90-8E6D-00A8ACCA531A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AB284C76-C880-4A90-8E6D-00A8ACCA531A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AB284C76-C880-4A90-8E6D-00A8ACCA531A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1BD4BC13-350F-48B2-8A5D-55585620470B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1BD4BC13-350F-48B2-8A5D-55585620470B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1BD4BC13-350F-48B2-8A5D-55585620470B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1BD4BC13-350F-48B2-8A5D-55585620470B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1901CFE4-7DA9-423E-A3A1-20A3444CC7F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1901CFE4-7DA9-423E-A3A1-20A3444CC7F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1901CFE4-7DA9-423E-A3A1-20A3444CC7F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1901CFE4-7DA9-423E-A3A1-20A3444CC7F7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -10,7 +10,7 @@ namespace DataModels.Models
|
||||
{
|
||||
string Model { get; }
|
||||
int Tonnage { get; }
|
||||
int StatusId { get; }
|
||||
int? StatusId { get; }
|
||||
string StatusTitle { get; }
|
||||
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace DataModels.Models
|
||||
public interface ICompany : IId
|
||||
{
|
||||
string Title { get; }
|
||||
int StatusId { get; }
|
||||
int? StatusId { get; }
|
||||
string StatusTitle { get; }
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace DataModels.Models
|
||||
{
|
||||
string Name { get; }
|
||||
string Phone { get; }
|
||||
int StatusId { get; }
|
||||
int? StatusId { get; }
|
||||
string StatusTitle { get; }
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ namespace DataModels.Models
|
||||
{
|
||||
public interface IRoute : IId
|
||||
{
|
||||
int PlaceStart { get; }
|
||||
int PlaceEnd { get; }
|
||||
int? PlaceStart { get; }
|
||||
int? PlaceEnd { get; }
|
||||
int Length { get; }
|
||||
string Title { get; }
|
||||
}
|
||||
|
@ -8,14 +8,14 @@ namespace DataModels.Models
|
||||
{
|
||||
public interface IVoyage : IId
|
||||
{
|
||||
int CarId { get; }
|
||||
int? CarId { get; }
|
||||
string CarName { get; }
|
||||
int HumanId { get; }
|
||||
int? HumanId { get; }
|
||||
string HumanName { get; }
|
||||
int CompanyId { get; }
|
||||
int? CompanyId { get; }
|
||||
string CompanyName { get; }
|
||||
int RouteId { get; }
|
||||
DateTime DateStart { get; }
|
||||
DateTime DateEnd { get; }
|
||||
int? RouteId { get; }
|
||||
DateOnly? DateStart { get; }
|
||||
DateOnly? DateEnd { get; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user