DataModels + Contracts

This commit is contained in:
russell 2024-04-27 23:49:22 +04:00
parent 3734a7b47a
commit ccbd9b2a7f
46 changed files with 801 additions and 0 deletions

View File

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32929.385
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TravelAgencyDataModels", "TravelAgencyDataModels\TravelAgencyDataModels.csproj", "{9C824913-01A0-456C-AD55-F47471596EAD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TravelAgencyContracts", "TravelAgencyContracts\TravelAgencyContracts.csproj", "{5A5C7696-4047-4BB8-BEC3-9DDB4000394E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9C824913-01A0-456C-AD55-F47471596EAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C824913-01A0-456C-AD55-F47471596EAD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C824913-01A0-456C-AD55-F47471596EAD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C824913-01A0-456C-AD55-F47471596EAD}.Release|Any CPU.Build.0 = Release|Any CPU
{5A5C7696-4047-4BB8-BEC3-9DDB4000394E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5A5C7696-4047-4BB8-BEC3-9DDB4000394E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5A5C7696-4047-4BB8-BEC3-9DDB4000394E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5A5C7696-4047-4BB8-BEC3-9DDB4000394E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {81490F8B-CB51-4068-B047-669976522A07}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,19 @@
using TravelAgencyDataModels.Models;
namespace TravelAgencyContracts.BindingModels
{
public class ExcursionBindingModel : IExcursionModel
{
public int Id { get; set; }
public string ExcursionName { get; set; } = string.Empty;
public string ExcursionDescription { get; set; } = string.Empty;
public double Price { get; set; }
public int UserId { get; set; }
public Dictionary<int, ITourModel> ExcursionTours { get; set; } = new();
}
}

View File

@ -0,0 +1,19 @@
using TravelAgencyDataModels.Models;
namespace TravelAgencyContracts.BindingModels
{
public class ExcursionGroupBindingModel : IExcursionGroupModel
{
public int Id { get; set; }
public string ExcursionGroupName { get; set; } = string.Empty;
public int ParticipantsAmount { get; set; }
public int UserId { get; set; }
public int GuideId { get; set; }
public Dictionary<int, ITourModel> ExcursionGroupTours { get; set; } = new();
}
}

View File

@ -0,0 +1,15 @@
using TravelAgencyDataModels.Models;
namespace TravelAgencyContracts.BindingModels
{
public class GuideBindingModel : IGuideModel
{
public int Id { get; set; }
public string GuideFIO { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public string PhoneNumber { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,15 @@
using TravelAgencyDataModels.Models;
namespace TravelAgencyContracts.BindingModels
{
public class PlaceBindingModel : IPlaceModel
{
public int Id { get; set; }
public string PlaceName { get; set; } = string.Empty;
public string PlaceAddress { get; set; } = string.Empty;
public int ExcursionId { get; set; }
}
}

View File

@ -0,0 +1,17 @@
using TravelAgencyDataModels.Models;
namespace TravelAgencyContracts.BindingModels
{
public class TourBindingModel : ITourModel
{
public int Id { get; set; }
public string TourName { get; set; } = string.Empty;
public string TourDescription { get; set; } = string.Empty;
public double Price { get; set; }
public int UserId { get; set; }
}
}

View File

@ -0,0 +1,17 @@
using TravelAgencyDataModels.Models;
namespace TravelAgencyContracts.BindingModels
{
public class TripBindingModel : ITripModel
{
public int Id { get; set; }
public string TripName { get; set; } = string.Empty;
public DateTime TripDate { get; set; }
public int GuideId { get; set; }
public Dictionary<int, IPlaceModel> TripPlaces { get; set; } = new();
}
}

View File

@ -0,0 +1,19 @@
using TravelAgencyDataModels.Models;
namespace TravelAgencyContracts.BindingModels
{
public class UserBindingModel : IUserModel
{
public int Id { get; set; }
public string UserFIO { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public string PhoneNumber { get; set; } = string.Empty;
public string Login { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,19 @@
using TravelAgencyContracts.BindingModels;
using TravelAgencyContracts.SearchModels;
using TravelAgencyContracts.ViewModels;
namespace TravelAgencyContracts.BusinessLogicsContracts
{
public interface IExcursionGroupLogic
{
List<ExcursionGroupViewModel>? ReadList(ExcursionGroupSearchModel? model);
ExcursionGroupViewModel? ReadElement(ExcursionGroupSearchModel model);
bool Create(ExcursionGroupBindingModel model);
bool Update(ExcursionGroupBindingModel model);
bool Delete(ExcursionGroupBindingModel model);
}
}

View File

@ -0,0 +1,19 @@
using TravelAgencyContracts.BindingModels;
using TravelAgencyContracts.SearchModels;
using TravelAgencyContracts.ViewModels;
namespace TravelAgencyContracts.BusinessLogicsContracts
{
public interface IExcursionLogic
{
List<ExcursionViewModel>? ReadList(ExcursionSearchModel? model);
ExcursionViewModel? ReadElement(ExcursionSearchModel model);
bool Create(ExcursionBindingModel model);
bool Update(ExcursionBindingModel model);
bool Delete(ExcursionBindingModel model);
}
}

View File

@ -0,0 +1,19 @@
using TravelAgencyContracts.BindingModels;
using TravelAgencyContracts.SearchModels;
using TravelAgencyContracts.ViewModels;
namespace TravelAgencyContracts.BusinessLogicsContracts
{
public interface IGuideLogic
{
List<GuideViewModel>? ReadList(GuideSearchModel? model);
GuideViewModel? ReadElement(GuideSearchModel model);
bool Create(GuideBindingModel model);
bool Update(GuideBindingModel model);
bool Delete(GuideBindingModel model);
}
}

View File

@ -0,0 +1,19 @@
using TravelAgencyContracts.BindingModels;
using TravelAgencyContracts.SearchModels;
using TravelAgencyContracts.ViewModels;
namespace TravelAgencyContracts.BusinessLogicsContracts
{
public interface IPlaceLogic
{
List<PlaceViewModel>? ReadList(PlaceSearchModel? model);
PlaceViewModel? ReadElement(PlaceSearchModel model);
bool Create(PlaceBindingModel model);
bool Update(PlaceBindingModel model);
bool Delete(PlaceBindingModel model);
}
}

View File

@ -0,0 +1,19 @@
using TravelAgencyContracts.BindingModels;
using TravelAgencyContracts.SearchModels;
using TravelAgencyContracts.ViewModels;
namespace TravelAgencyContracts.BusinessLogicsContracts
{
public interface ITourLogic
{
List<TourViewModel>? ReadList(TourSearchModel? model);
TourViewModel? ReadElement(TourSearchModel model);
bool Create(TourBindingModel model);
bool Update(TourBindingModel model);
bool Delete(TourBindingModel model);
}
}

View File

@ -0,0 +1,19 @@
using TravelAgencyContracts.BindingModels;
using TravelAgencyContracts.SearchModels;
using TravelAgencyContracts.ViewModels;
namespace TravelAgencyContracts.BusinessLogicsContracts
{
public interface ITripLogic
{
List<TripViewModel>? ReadList(TripSearchModel? model);
TripViewModel? ReadElement(TripSearchModel model);
bool Create(TripBindingModel model);
bool Update(TripBindingModel model);
bool Delete(TripBindingModel model);
}
}

View File

@ -0,0 +1,19 @@
using TravelAgencyContracts.BindingModels;
using TravelAgencyContracts.SearchModels;
using TravelAgencyContracts.ViewModels;
namespace TravelAgencyContracts.BusinessLogicsContracts
{
public interface IUserLogic
{
List<UserViewModel>? ReadList(UserSearchModel? model);
UserViewModel? ReadElement(UserSearchModel model);
bool Create(UserBindingModel model);
bool Update(UserBindingModel model);
bool Delete(UserBindingModel model);
}
}

View File

@ -0,0 +1,13 @@
namespace TravelAgencyContracts.SearchModels
{
public class ExcursionGroupSearchModel
{
public int? Id { get; set; }
public string? ExcursionGroupName { get; set; }
public int? UserId { get; set; }
public int? GuideId { get; set; }
}
}

View File

@ -0,0 +1,11 @@
namespace TravelAgencyContracts.SearchModels
{
public class ExcursionSearchModel
{
public int? Id { get; set; }
public string? ExcursionName { get; set; }
public int? UserId { get; set; }
}
}

View File

@ -0,0 +1,13 @@
namespace TravelAgencyContracts.SearchModels
{
public class GuideSearchModel
{
public int? Id { get; set; }
public string? GuideFIO { get; set; }
public string? Email { get; set; }
public string? PhoneNumber { get; set; }
}
}

View File

@ -0,0 +1,13 @@
namespace TravelAgencyContracts.SearchModels
{
public class PlaceSearchModel
{
public int? Id { get; set; }
public string? PlaceName { get; set; }
public string? PlaceAddress { get; set; }
public int? ExcursionId { get; set; }
}
}

View File

@ -0,0 +1,11 @@
namespace TravelAgencyContracts.SearchModels
{
public class TourSearchModel
{
public int? Id { get; set; }
public string? TourName { get; set; }
public int? UserId { get; set; }
}
}

View File

@ -0,0 +1,13 @@
namespace TravelAgencyContracts.SearchModels
{
public class TripSearchModel
{
public int? Id { get; set; }
public string? TripName { get; set; }
public DateTime? DateTrip { get; set; }
public int? GuideId { get; set; }
}
}

View File

@ -0,0 +1,17 @@
namespace TravelAgencyContracts.SearchModels
{
public class UserSearchModel
{
public int? Id { get; set; }
public string? UserFIO { get; set; }
public string? Email { get; set; }
public string? PhoneNumber { get; set; }
public string? Login { get; set; }
public string? Password { get; set; }
}
}

View File

@ -0,0 +1,21 @@
using TravelAgencyContracts.BindingModels;
using TravelAgencyContracts.SearchModels;
using TravelAgencyContracts.ViewModels;
namespace TravelAgencyContracts.StoragesContracts
{
public interface IExcursionGroupStorage
{
List<ExcursionGroupViewModel> GetFullList();
List<ExcursionGroupViewModel> GetFilteredList(ExcursionGroupSearchModel model);
ExcursionGroupViewModel? GetElement(ExcursionGroupSearchModel model);
ExcursionGroupViewModel? Insert(ExcursionGroupBindingModel model);
ExcursionGroupViewModel? Update(ExcursionGroupBindingModel model);
ExcursionGroupViewModel? Delete(ExcursionGroupBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using TravelAgencyContracts.BindingModels;
using TravelAgencyContracts.SearchModels;
using TravelAgencyContracts.ViewModels;
namespace TravelAgencyContracts.StoragesContracts
{
public interface IExcursionStorage
{
List<ExcursionViewModel> GetFullList();
List<ExcursionViewModel> GetFilteredList(ExcursionSearchModel model);
ExcursionViewModel? GetElement(ExcursionSearchModel model);
ExcursionViewModel? Insert(ExcursionBindingModel model);
ExcursionViewModel? Update(ExcursionBindingModel model);
ExcursionViewModel? Delete(ExcursionBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using TravelAgencyContracts.BindingModels;
using TravelAgencyContracts.SearchModels;
using TravelAgencyContracts.ViewModels;
namespace TravelAgencyContracts.StoragesContracts
{
public interface IGuideStorage
{
List<GuideViewModel> GetFullList();
List<GuideViewModel> GetFilteredList(GuideSearchModel model);
GuideViewModel? GetElement(GuideSearchModel model);
GuideViewModel? Insert(GuideBindingModel model);
GuideViewModel? Update(GuideBindingModel model);
GuideViewModel? Delete(GuideBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using TravelAgencyContracts.BindingModels;
using TravelAgencyContracts.SearchModels;
using TravelAgencyContracts.ViewModels;
namespace TravelAgencyContracts.StoragesContracts
{
public interface IPlaceStorage
{
List<PlaceViewModel> GetFullList();
List<PlaceViewModel> GetFilteredList(PlaceSearchModel model);
PlaceViewModel? GetElement(PlaceSearchModel model);
PlaceViewModel? Insert(PlaceBindingModel model);
PlaceViewModel? Update(PlaceBindingModel model);
PlaceViewModel? Delete(PlaceBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using TravelAgencyContracts.BindingModels;
using TravelAgencyContracts.SearchModels;
using TravelAgencyContracts.ViewModels;
namespace TravelAgencyContracts.StoragesContracts
{
public interface ITourStorage
{
List<TourViewModel> GetFullList();
List<TourViewModel> GetFilteredList(TourSearchModel model);
TourViewModel? GetElement(TourSearchModel model);
TourViewModel? Insert(TourBindingModel model);
TourViewModel? Update(TourBindingModel model);
TourViewModel? Delete(TourBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using TravelAgencyContracts.BindingModels;
using TravelAgencyContracts.SearchModels;
using TravelAgencyContracts.ViewModels;
namespace TravelAgencyContracts.StoragesContracts
{
public interface ITripStorage
{
List<TripViewModel> GetFullList();
List<TripViewModel> GetFilteredList(TripSearchModel model);
TripViewModel? GetElement(TripSearchModel model);
TripViewModel? Insert(TripBindingModel model);
TripViewModel? Update(TripBindingModel model);
TripViewModel? Delete(TripBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
using TravelAgencyContracts.BindingModels;
using TravelAgencyContracts.SearchModels;
using TravelAgencyContracts.ViewModels;
namespace TravelAgencyContracts.StoragesContracts
{
public interface IUserStorage
{
List<UserViewModel> GetFullList();
List<UserViewModel> GetFilteredList(UserSearchModel model);
UserViewModel? GetElement(UserSearchModel model);
UserViewModel? Insert(UserBindingModel model);
UserViewModel? Update(UserBindingModel model);
UserViewModel? Delete(UserBindingModel model);
}
}

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="..\TravelAgencyDataModels\TravelAgencyDataModels.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,22 @@
using System.ComponentModel;
using TravelAgencyDataModels.Models;
namespace TravelAgencyContracts.ViewModels
{
public class ExcursionGroupViewModel
{
public int Id { get; set; }
[DisplayName("Название экскурсии")]
public string ExcursionGroupName { get; set; } = string.Empty;
[DisplayName("Количество участников")]
public int ParticipantsAmount { get; set; }
public int UserId { get; set; }
public int GuideId { get; set; }
public Dictionary<int, ITourModel> ExcursionGroupTours { get; set; } = new();
}
}

View File

@ -0,0 +1,23 @@
using System.ComponentModel;
using TravelAgencyDataModels.Models;
namespace TravelAgencyContracts.ViewModels
{
public class ExcursionViewModel
{
public int Id { get; set; }
[DisplayName("Название экскурсии")]
public string ExcursionName { get; set; } = string.Empty;
[DisplayName("Описание экскурсии")]
public string ExcursionDescription { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Price { get; set; }
public int UserId { get; set; }
public Dictionary<int, ITourModel> ExcursionTours { get; set; } = new();
}
}

View File

@ -0,0 +1,18 @@
using System.ComponentModel;
namespace TravelAgencyContracts.ViewModels
{
public class GuideViewModel
{
public int Id { get; set; }
[DisplayName("ФИО гида")]
public string GuideFIO { get; set; } = string.Empty;
[DisplayName("Эл. почта")]
public string Email { get; set; } = string.Empty;
[DisplayName("Номер телефона")]
public string PhoneNumber { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,17 @@
using System.ComponentModel;
namespace TravelAgencyContracts.ViewModels
{
public class PlaceViewModel
{
public int Id { get; set; }
[DisplayName("Название места")]
public string PlaceName { get; set; } = string.Empty;
[DisplayName("Адрес места")]
public string PlaceAddress { get; set; } = string.Empty;
public int ExcursionId { get; set; }
}
}

View File

@ -0,0 +1,20 @@
using System.ComponentModel;
namespace TravelAgencyContracts.ViewModels
{
public class TourViewModel
{
public int Id { get; set; }
[DisplayName("Название тура")]
public string TourName { get; set; } = string.Empty;
[DisplayName("Описание тура")]
public string TourDescription { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Price { get; set; }
public int UserId { get; set; }
}
}

View File

@ -0,0 +1,20 @@
using System.ComponentModel;
using TravelAgencyDataModels.Models;
namespace TravelAgencyContracts.ViewModels
{
public class TripViewModel
{
public int Id { get; set; }
[DisplayName("Название поездки")]
public string TripName { get; set; } = string.Empty;
[DisplayName("Дата поездки")]
public DateTime TripDate { get; set; }
public int GuideId { get; set; }
public Dictionary<int, IPlaceModel> TripPlaces { get; set; } = new();
}
}

View File

@ -0,0 +1,24 @@
using System.ComponentModel;
namespace TravelAgencyContracts.ViewModels
{
public class UserViewModel
{
public int Id { get; set; }
[DisplayName("ФИО пользователя")]
public string UserFIO { get; set; } = string.Empty;
[DisplayName("Эл. почта")]
public string Email { get; set; } = string.Empty;
[DisplayName("Номер телефона")]
public string PhoneNumber { get; set; } = string.Empty;
[DisplayName("Логин")]
public string Login { get; set; } = string.Empty;
[DisplayName("Пароль")]
public string Password { get; set; } = string.Empty;
}
}

View File

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

View File

@ -0,0 +1,15 @@
namespace TravelAgencyDataModels.Models
{
public interface IExcursionGroupModel : IId
{
string ExcursionGroupName { get; }
int ParticipantsAmount { get; }
int UserId { get; }
int GuideId { get; }
Dictionary<int, ITourModel> ExcursionGroupTours { get; }
}
}

View File

@ -0,0 +1,15 @@
namespace TravelAgencyDataModels.Models
{
public interface IExcursionModel : IId
{
string ExcursionName { get; }
string ExcursionDescription { get; }
double Price { get; }
int UserId { get; }
Dictionary<int, ITourModel> ExcursionTours { get; }
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TravelAgencyDataModels.Models
{
public interface IGuideModel :IId
{
string GuideFIO { get; }
string Email { get; }
string PhoneNumber { get; }
}
}

View File

@ -0,0 +1,11 @@
namespace TravelAgencyDataModels.Models
{
public interface IPlaceModel : IId
{
string PlaceName { get; }
string PlaceAddress { get; }
int ExcursionId { get; }
}
}

View File

@ -0,0 +1,13 @@
namespace TravelAgencyDataModels.Models
{
public interface ITourModel : IId
{
string TourName { get; }
string TourDescription { get; }
double Price { get; }
int UserId { get; }
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TravelAgencyDataModels.Models
{
public interface ITripModel : IId
{
string TripName { get; }
DateTime TripDate { get; }
int GuideId { get; }
Dictionary<int, IPlaceModel> TripPlaces { get; }
}
}

View File

@ -0,0 +1,15 @@
namespace TravelAgencyDataModels.Models
{
public interface IUserModel : IId
{
string UserFIO { get; }
string Email { get; }
string PhoneNumber { get; }
string Login { get; }
string Password { 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>