From 585132da4a9d2ee5c88284515805a5a89e83a2ab Mon Sep 17 00:00:00 2001 From: VictoriaPresnyakova Date: Wed, 3 May 2023 19:18:39 +0400 Subject: [PATCH] view & binding --- .../BusinessLogicsContracts/IRouteLogic.cs | 8 ++++++ .../BusinessLogicsContracts/IStopLogic.cs | 8 ++++++ .../ITransportTypeLogic.cs | 8 ++++++ .../ViewModels/RouteViewModel.cs | 26 +++++++++++++++++++ .../ViewModels/StopViewModel.cs | 18 +++++++++++++ .../ViewModels/TransportTypeViewModel.cs | 20 ++++++++++++++ 6 files changed, 88 insertions(+) create mode 100644 TransportGuideContracts/ViewModels/RouteViewModel.cs create mode 100644 TransportGuideContracts/ViewModels/StopViewModel.cs create mode 100644 TransportGuideContracts/ViewModels/TransportTypeViewModel.cs diff --git a/TransportGuideContracts/BusinessLogicsContracts/IRouteLogic.cs b/TransportGuideContracts/BusinessLogicsContracts/IRouteLogic.cs index 62f2f45..7ed5c51 100644 --- a/TransportGuideContracts/BusinessLogicsContracts/IRouteLogic.cs +++ b/TransportGuideContracts/BusinessLogicsContracts/IRouteLogic.cs @@ -3,10 +3,18 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using TransportGuideContracts.BindingModels; +using TransportGuideContracts.SearchModels; +using TransportGuideContracts.ViewModels; namespace TransportGuideContracts.BusinessLogicsContracts { public interface IRouteLogic { + List? ReadList(RouteSearchModel? model); + RouteViewModel? ReadElement(RouteSearchModel model); + bool Create(RouteBindingModel model); + bool Update(RouteBindingModel model); + bool Delete(RouteBindingModel model); } } diff --git a/TransportGuideContracts/BusinessLogicsContracts/IStopLogic.cs b/TransportGuideContracts/BusinessLogicsContracts/IStopLogic.cs index 0b76da8..4993f94 100644 --- a/TransportGuideContracts/BusinessLogicsContracts/IStopLogic.cs +++ b/TransportGuideContracts/BusinessLogicsContracts/IStopLogic.cs @@ -3,10 +3,18 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using TransportGuideContracts.BindingModels; +using TransportGuideContracts.SearchModels; +using TransportGuideContracts.ViewModels; namespace TransportGuideContracts.BusinessLogicsContracts { public interface IStopLogic { + List? ReadList(StopSearchModel? model); + StopViewModel? ReadElement(StopSearchModel model); + bool Create(StopBindingModel model); + bool Update(StopBindingModel model); + bool Delete(StopBindingModel model); } } diff --git a/TransportGuideContracts/BusinessLogicsContracts/ITransportTypeLogic.cs b/TransportGuideContracts/BusinessLogicsContracts/ITransportTypeLogic.cs index 8aec84c..8514dc7 100644 --- a/TransportGuideContracts/BusinessLogicsContracts/ITransportTypeLogic.cs +++ b/TransportGuideContracts/BusinessLogicsContracts/ITransportTypeLogic.cs @@ -3,10 +3,18 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using TransportGuideContracts.BindingModels; +using TransportGuideContracts.SearchModels; +using TransportGuideContracts.ViewModels; namespace TransportGuideContracts.BusinessLogicsContracts { public interface ITransportTypeLogic { + List? ReadList(TransportTypeSearchModel? model); + TransportTypeViewModel? ReadElement(TransportTypeSearchModel model); + bool Create(TransportTypeBindingModel model); + bool Update(TransportTypeBindingModel model); + bool Delete(TransportTypeBindingModel model); } } diff --git a/TransportGuideContracts/ViewModels/RouteViewModel.cs b/TransportGuideContracts/ViewModels/RouteViewModel.cs new file mode 100644 index 0000000..d656866 --- /dev/null +++ b/TransportGuideContracts/ViewModels/RouteViewModel.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TransportGuideDataModels.Models; +using System.ComponentModel; + +namespace TransportGuideContracts.ViewModels +{ + public class RouteViewModel : IRouteModel + { + [DisplayName("Rout's name")] + public string Name { get; set; } = string.Empty; + [DisplayName("Rout's IP")] + public string IP { get; set; } = string.Empty; + + public int TransportTypeId { get; set; } + [DisplayName("TransportType")] + public string TransportTypeName { get; set; } = string.Empty; + + public Dictionary StopNRoute { get; set; } = new(); + + public int Id { get; set; } + } +} diff --git a/TransportGuideContracts/ViewModels/StopViewModel.cs b/TransportGuideContracts/ViewModels/StopViewModel.cs new file mode 100644 index 0000000..81bf8ec --- /dev/null +++ b/TransportGuideContracts/ViewModels/StopViewModel.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TransportGuideDataModels.Models; +using System.ComponentModel; + +namespace TransportGuideContracts.ViewModels +{ + public class StopViewModel : IStopModel + { + [DisplayName("Stop's name")] + public string Name { get; set; } = string.Empty; + + public int Id { get; set; } + } +} diff --git a/TransportGuideContracts/ViewModels/TransportTypeViewModel.cs b/TransportGuideContracts/ViewModels/TransportTypeViewModel.cs new file mode 100644 index 0000000..6e4dbed --- /dev/null +++ b/TransportGuideContracts/ViewModels/TransportTypeViewModel.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TransportGuideDataModels.Models; +using System.ComponentModel; + +namespace TransportGuideContracts.ViewModels +{ + public class TransportTypeViewModel : ITransportTypeModel + { + [DisplayName("Ticket's Price")] + public double price { get; set; } + [DisplayName("Transport type name")] + public string name { get; set; } = string.Empty; + + public int Id { get; set; } + } +}