Реализация DataModels и Contracts.

This commit is contained in:
Anastasia 2023-05-14 14:39:25 +04:00
parent 7c4a33dec0
commit a1506b0e50
29 changed files with 518 additions and 1 deletions

View File

@ -3,7 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32819.101
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RouteGuide", "RouteGuide\RouteGuide.csproj", "{7CFC8C9A-8F17-41F0-8AE1-36FDCF5CC0F6}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RouteGuide", "RouteGuide\RouteGuide.csproj", "{7CFC8C9A-8F17-41F0-8AE1-36FDCF5CC0F6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RouteGuideDataModels", "RouteGuideDataModels\RouteGuideDataModels.csproj", "{5DD8F223-307E-4B13-9EEB-DDC0DCDC10F0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RouteGuideContracts", "RouteGuideContracts\RouteGuideContracts.csproj", "{A27C89B3-F629-4553-B928-EE22147EBD86}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -15,6 +19,14 @@ Global
{7CFC8C9A-8F17-41F0-8AE1-36FDCF5CC0F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7CFC8C9A-8F17-41F0-8AE1-36FDCF5CC0F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7CFC8C9A-8F17-41F0-8AE1-36FDCF5CC0F6}.Release|Any CPU.Build.0 = Release|Any CPU
{5DD8F223-307E-4B13-9EEB-DDC0DCDC10F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5DD8F223-307E-4B13-9EEB-DDC0DCDC10F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5DD8F223-307E-4B13-9EEB-DDC0DCDC10F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5DD8F223-307E-4B13-9EEB-DDC0DCDC10F0}.Release|Any CPU.Build.0 = Release|Any CPU
{A27C89B3-F629-4553-B928-EE22147EBD86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A27C89B3-F629-4553-B928-EE22147EBD86}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A27C89B3-F629-4553-B928-EE22147EBD86}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A27C89B3-F629-4553-B928-EE22147EBD86}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,18 @@
using RouteGuideDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideContracts.BindingModels
{
public class RouteBindingModel : IRouteModel
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public Dictionary<int, (IStopModel, int)> RouteStops { get; set; } = new();
}
}

View File

@ -0,0 +1,16 @@
using RouteGuideDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideContracts.BindingModels
{
public class StopBindingModel : IStopModel
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,20 @@
using RouteGuideDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideContracts.BindingModels
{
public class TransportBindingModel : ITransportModel
{
public int Id { get; set; }
public string DriverName { get; set; } = string.Empty;
public int TransportTypeId { get; set; }
public int RouteId { get; set; }
}
}

View File

@ -0,0 +1,18 @@
using RouteGuideDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideContracts.BindingModels
{
public class TransportTypeBindingModel : ITransportTypeModel
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public double Price { get; set; }
}
}

View File

@ -0,0 +1,22 @@
using RouteGuideContracts.BindingModels;
using RouteGuideContracts.SearchModels;
using RouteGuideContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideContracts.BusinessLogicContracts
{
public interface IRouteLogic
{
List<RouteViewModel>? ReadList(RouteSearchModel? model);
RouteViewModel? ReadElement(RouteSearchModel model);
bool Create(RouteBindingModel model);
bool Update(RouteBindingModel model);
bool Delete(RouteBindingModel model);
}
}

View File

@ -0,0 +1,22 @@
using RouteGuideContracts.BindingModels;
using RouteGuideContracts.SearchModels;
using RouteGuideContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideContracts.BusinessLogicContracts
{
public interface IStopLogic
{
List<StopViewModel>? ReadList(StopSearchModel? model);
StopViewModel? ReadElement(StopSearchModel model);
bool Create(StopBindingModel model);
bool Update(StopBindingModel model);
bool Delete(StopBindingModel model);
}
}

View File

@ -0,0 +1,22 @@
using RouteGuideContracts.BindingModels;
using RouteGuideContracts.SearchModels;
using RouteGuideContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideContracts.BusinessLogicContracts
{
public interface ITransportLogic
{
List<TransportViewModel>? ReadList(TransportSearchModel? model);
TransportViewModel? ReadElement(TransportSearchModel model);
bool Create(TransportBindingModel model);
bool Update(TransportBindingModel model);
bool Delete(TransportBindingModel model);
}
}

View File

@ -0,0 +1,22 @@
using RouteGuideContracts.BindingModels;
using RouteGuideContracts.SearchModels;
using RouteGuideContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideContracts.BusinessLogicContracts
{
public interface ITransportTypeLogic
{
List<TransportTypeViewModel>? ReadList(TransportTypeSearchModel? model);
TransportTypeViewModel? ReadElement(TransportTypeSearchModel model);
bool Create(TransportTypeBindingModel model);
bool Update(TransportTypeBindingModel model);
bool Delete(TransportTypeBindingModel model);
}
}

View File

@ -0,0 +1,7 @@
namespace RouteGuideContracts
{
public class Class1
{
}
}

View File

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\RouteGuideDataModels\RouteGuideDataModels.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideContracts.SearchModels
{
public class RouteSearchModel
{
public int? Id { get; set; }
public string? Name { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideContracts.SearchModels
{
public class StopSearchModel
{
public int? Id { get; set; }
public string? Name { get; set; }
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideContracts.SearchModels
{
public class TransportSearchModel
{
public int? Id { get; set; }
public string? DriverName { get; set; } = string.Empty;
public int? TransportTypeId { get; set; }
public int? RouteId { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideContracts.SearchModels
{
public class TransportTypeSearchModel
{
public int? Id { get; set; }
public string? Name { get; set; }
}
}

View File

@ -0,0 +1,24 @@
using RouteGuideContracts.BindingModels;
using RouteGuideContracts.SearchModels;
using RouteGuideContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideContracts.StoragesModels
{
public interface IRouteStorage
{
List<RouteViewModel> GetFullList();
List<RouteViewModel> GetFilteredList(RouteSearchModel model);
RouteViewModel? GetElement(RouteSearchModel model);
RouteViewModel? Insert(RouteBindingModel model);
RouteViewModel? Update(RouteBindingModel model);
RouteViewModel? Delete(RouteBindingModel model);
}
}

View File

@ -0,0 +1,24 @@
using RouteGuideContracts.BindingModels;
using RouteGuideContracts.SearchModels;
using RouteGuideContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideContracts.StoragesModels
{
public interface IStopStorage
{
List<StopViewModel> GetFullList();
List<StopViewModel> GetFilteredList(StopSearchModel model);
StopViewModel? GetElement(StopSearchModel model);
StopViewModel? Insert(StopBindingModel model);
StopViewModel? Update(StopBindingModel model);
StopViewModel? Delete(StopBindingModel model);
}
}

View File

@ -0,0 +1,24 @@
using RouteGuideContracts.BindingModels;
using RouteGuideContracts.SearchModels;
using RouteGuideContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideContracts.StoragesModels
{
public interface ITransportStorage
{
List<TransportViewModel> GetFullList();
List<TransportViewModel> GetFilteredList(TransportSearchModel model);
TransportViewModel? GetElement(TransportSearchModel model);
TransportViewModel? Insert(TransportBindingModel model);
TransportViewModel? Update(TransportBindingModel model);
TransportViewModel? Delete(TransportBindingModel model);
}
}

View File

@ -0,0 +1,24 @@
using RouteGuideContracts.BindingModels;
using RouteGuideContracts.SearchModels;
using RouteGuideContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideContracts.StoragesModels
{
public interface ITransportTypeStorage
{
List<TransportTypeViewModel> GetFullList();
List<TransportTypeViewModel> GetFilteredList(TransportTypeSearchModel model);
TransportTypeViewModel? GetElement(TransportTypeSearchModel model);
TransportTypeViewModel? Insert(TransportTypeBindingModel model);
TransportTypeViewModel? Update(TransportTypeBindingModel model);
TransportTypeViewModel? Delete(TransportTypeBindingModel model);
}
}

View File

@ -0,0 +1,20 @@
using RouteGuideDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideContracts.ViewModels
{
public class RouteViewModel : IRouteModel
{
[DisplayName("Название маршрута")]
public string Name { get; set; } = string.Empty;
public Dictionary<int, (IStopModel, int)> RouteStops { get; set; } = new();
public int Id { get; set; }
}
}

View File

@ -0,0 +1,18 @@
using RouteGuideDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideContracts.ViewModels
{
public class StopViewModel : IStopModel
{
[DisplayName("Название остановки")]
public string Name { get; set; } = string.Empty;
public int Id { get; set; }
}
}

View File

@ -0,0 +1,21 @@
using RouteGuideDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideContracts.ViewModels
{
public class TransportTypeViewModel : ITransportTypeModel
{
[DisplayName("Стоимость проезда")]
public double Price { get; set; }
[DisplayName("Тип транспорта")]
public string Name { get; set; } = string.Empty;
public int Id { get; set; }
}
}

View File

@ -0,0 +1,29 @@
using RouteGuideDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideContracts.ViewModels
{
public class TransportViewModel : ITransportModel
{
[DisplayName("Водитель")]
public string DriverName { get; set; } = string.Empty;
public int TransportTypeId { get; set; }
[DisplayName("Тип транспорта")]
public int TransportTypeName { get; set; }
[DisplayName("Номер маршрута")]
public int RouteId { get; set; }
[DisplayName("Название маршрута")]
public int RouteName { get; set; }
public int Id { get; set; }
}
}

View File

@ -0,0 +1,7 @@
namespace RouteGuideDataModels
{
public interface IId
{
int Id { get; }
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideDataModels.Models
{
public interface IRouteModel : IId
{
string Name { get; }
Dictionary<int, (IStopModel, int)> RouteStops { get; }
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideDataModels.Models
{
public interface IStopModel : IId
{
string Name { get; }
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideDataModels.Models
{
public interface ITransportModel : IId
{
string DriverName { get; }
int TransportTypeId { get; }
int RouteId { get; }
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RouteGuideDataModels.Models
{
public interface ITransportTypeModel : IId
{
string Name { get; }
double Price { get; }
}
}

View File

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>