Compare commits
5 Commits
main
...
BisinessLi
Author | SHA1 | Date | |
---|---|---|---|
|
ac02c11334 | ||
|
0434c5f14c | ||
|
550ec77222 | ||
|
cb98039241 | ||
|
78ffb8ff1b |
@ -3,7 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.2.32602.215
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchoolApp", "SchoolApp\SchoolApp.csproj", "{9E7F8CCA-B349-49EC-B85E-D54299CC2759}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SchoolApp", "SchoolApp\SchoolApp.csproj", "{9E7F8CCA-B349-49EC-B85E-D54299CC2759}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SchoolDataModels", "SchoolsDataModels\SchoolDataModels.csproj", "{ADBB4992-BE2F-4B10-83CC-335E5B92EA35}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchoolContracts", "SchoolContracts\SchoolContracts.csproj", "{D58B0AFE-E28D-4583-B9F1-C0EDF443243F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SchoolBusinessLogic", "SchoolBusinessLogic\SchoolBusinessLogic.csproj", "{E78D42A3-7FA0-4E3A-B0C8-AEC70B3EE331}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -15,6 +21,18 @@ Global
|
||||
{9E7F8CCA-B349-49EC-B85E-D54299CC2759}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9E7F8CCA-B349-49EC-B85E-D54299CC2759}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9E7F8CCA-B349-49EC-B85E-D54299CC2759}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{ADBB4992-BE2F-4B10-83CC-335E5B92EA35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{ADBB4992-BE2F-4B10-83CC-335E5B92EA35}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{ADBB4992-BE2F-4B10-83CC-335E5B92EA35}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{ADBB4992-BE2F-4B10-83CC-335E5B92EA35}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D58B0AFE-E28D-4583-B9F1-C0EDF443243F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D58B0AFE-E28D-4583-B9F1-C0EDF443243F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D58B0AFE-E28D-4583-B9F1-C0EDF443243F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D58B0AFE-E28D-4583-B9F1-C0EDF443243F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E78D42A3-7FA0-4E3A-B0C8-AEC70B3EE331}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E78D42A3-7FA0-4E3A-B0C8-AEC70B3EE331}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E78D42A3-7FA0-4E3A-B0C8-AEC70B3EE331}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E78D42A3-7FA0-4E3A-B0C8-AEC70B3EE331}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
111
School/SchoolBusinessLogic/BusinessLogic/AchievementLogic.cs
Normal file
111
School/SchoolBusinessLogic/BusinessLogic/AchievementLogic.cs
Normal file
@ -0,0 +1,111 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.BusinessLogicsContracts;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.StoragesContracts;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolBusinessLogic.BusinessLogic
|
||||
{
|
||||
public class AchievementLogic : IAchievementLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IAchievementStorage _AchievementStorage;
|
||||
|
||||
public AchievementLogic(ILogger<AchievementLogic> logger, IAchievementStorage AchievementStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_AchievementStorage = AchievementStorage;
|
||||
}
|
||||
|
||||
public List<AchievementViewModel>? ReadList(AchievementSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. Name:{Name} AchievementId:{Id}", model?.Name, model?.Id);
|
||||
var list = model == null ? _AchievementStorage.GetFullList() : _AchievementStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public AchievementViewModel? ReadElement(AchievementSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement.Id:{ Id}", model.Id);
|
||||
var element = _AchievementStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public bool Create(AchievementBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_AchievementStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public bool Update(AchievementBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_AchievementStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(AchievementBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_AchievementStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(AchievementBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Name))
|
||||
{
|
||||
throw new ArgumentNullException("Нет названия достижения",
|
||||
nameof(model.Name));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Description))
|
||||
{
|
||||
throw new ArgumentNullException("Нет описания достижения",
|
||||
nameof(model.Description));
|
||||
}
|
||||
_logger.LogInformation("Achievement. Id:{Id}. LessonId:{LessonId}. Name:{Name}. Description:{Description} .ReceiptDate{ReceiptDate}", model.Id, model.LessonId, model.Name, model.Description, model.ReceiptDate);
|
||||
}
|
||||
}
|
||||
}
|
117
School/SchoolBusinessLogic/BusinessLogic/InterestLogic.cs
Normal file
117
School/SchoolBusinessLogic/BusinessLogic/InterestLogic.cs
Normal file
@ -0,0 +1,117 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.BusinessLogicsContracts;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.StoragesContracts;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolBusinessLogic.BusinessLogic
|
||||
{
|
||||
public class InterestLogic : IInterestLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IInterestStorage _InterestStorage;
|
||||
public InterestLogic(ILogger<InterestLogic> logger, IInterestStorage
|
||||
InterestStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_InterestStorage = InterestStorage;
|
||||
}
|
||||
public List<InterestViewModel>? ReadList(InterestSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. InterestName:{InterestName}.Id:{ Id}", model?.Name, model?.Id);
|
||||
var list = model == null ? _InterestStorage.GetFullList() :
|
||||
_InterestStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list?.Count);
|
||||
return list;
|
||||
}
|
||||
public InterestViewModel? ReadElement(InterestSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. InterestName:{InterestName}.Id:{ Id}", model.Name, model.Id);
|
||||
var element = _InterestStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
public bool Create(InterestBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_InterestStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Update(InterestBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_InterestStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(InterestBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_InterestStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(InterestBindingModel model, bool withParams =
|
||||
true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Name))
|
||||
{
|
||||
throw new ArgumentNullException("Нет названия интереса",
|
||||
nameof(model.Name));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Direction))
|
||||
{
|
||||
throw new ArgumentNullException("Нет направления интереса",
|
||||
nameof(model.Direction));
|
||||
}
|
||||
_logger.LogInformation("Interest. InterestName:{InterestName}.Direction:{Direction}. Id: { Id}", model.Name, model.Direction, model.Id);
|
||||
var element = _InterestStorage.GetElement(new InterestSearchModel
|
||||
{
|
||||
Name = model.Name
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Интерес с таким названием уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
107
School/SchoolBusinessLogic/BusinessLogic/LessonLogic.cs
Normal file
107
School/SchoolBusinessLogic/BusinessLogic/LessonLogic.cs
Normal file
@ -0,0 +1,107 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.BusinessLogicsContracts;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.StoragesContracts;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolBusinessLogic.BusinessLogic
|
||||
{
|
||||
public class LessonLogic : ILessonLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILessonStorage _LessonStorage;
|
||||
|
||||
public LessonLogic(ILogger<LessonLogic> logger, ILessonStorage LessonStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_LessonStorage = LessonStorage;
|
||||
}
|
||||
|
||||
public List<LessonViewModel>? ReadList(LessonSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. LessonId:{Id}", model?.Id);
|
||||
var list = model == null ? _LessonStorage.GetFullList() : _LessonStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||
return list;
|
||||
}
|
||||
|
||||
public LessonViewModel? ReadElement(LessonSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement.Id:{ Id}", model.Id);
|
||||
var element = _LessonStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public bool Create(LessonBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_LessonStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public bool Update(LessonBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_LessonStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(LessonBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_LessonStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CheckModel(LessonBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (model.TimeStart >= model.TimeEnd)
|
||||
{
|
||||
throw new ArgumentNullException("Занятие должно начинаться раньше чем заканчивается");
|
||||
}
|
||||
_logger.LogInformation("Lesson. Id:{Id}. UserId:{UserId}. TimeStart:{TimeStart}. TimeEnd:{TimeEnd}", model.Id, model.UserId, model.TimeStart, model.TimeEnd);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
127
School/SchoolBusinessLogic/BusinessLogic/UserLogic.cs
Normal file
127
School/SchoolBusinessLogic/BusinessLogic/UserLogic.cs
Normal file
@ -0,0 +1,127 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.BusinessLogicsContracts;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.StoragesContracts;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolBusinessLogic.BusinessLogic
|
||||
{
|
||||
public class UserLogic : IUserLogic
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IUserStorage _UserStorage;
|
||||
public UserLogic(ILogger<UserLogic> logger, IUserStorage
|
||||
UserStorage)
|
||||
{
|
||||
_logger = logger;
|
||||
_UserStorage = UserStorage;
|
||||
}
|
||||
public List<UserViewModel>? ReadList(UserSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. UserName:{UserName}.Id:{ Id}", model?.Name, model?.Id);
|
||||
var list = model == null ? _UserStorage.GetFullList() :
|
||||
_UserStorage.GetFilteredList(model);
|
||||
if (list == null)
|
||||
{
|
||||
_logger.LogWarning("ReadList return null list");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadList. Count:{Count}", list?.Count);
|
||||
return list;
|
||||
}
|
||||
public UserViewModel? ReadElement(UserSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
_logger.LogInformation("ReadElement. UserName:{Name}.Id:{ Id}", model.Name, model.Id);
|
||||
var element = _UserStorage.GetElement(model);
|
||||
if (element == null)
|
||||
{
|
||||
_logger.LogWarning("ReadElement element not found");
|
||||
return null;
|
||||
}
|
||||
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||
return element;
|
||||
}
|
||||
public bool Create(UserBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_UserStorage.Insert(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Insert operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Update(UserBindingModel model)
|
||||
{
|
||||
CheckModel(model);
|
||||
if (_UserStorage.Update(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool Delete(UserBindingModel model)
|
||||
{
|
||||
CheckModel(model, false);
|
||||
_logger.LogInformation("Delete. Id:{Id}", model.Id);
|
||||
if (_UserStorage.Delete(model) == null)
|
||||
{
|
||||
_logger.LogWarning("Delete operation failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void CheckModel(UserBindingModel model, bool withParams =
|
||||
true)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
if (!withParams)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Name))
|
||||
{
|
||||
throw new ArgumentNullException("Нет имени пользователя",
|
||||
nameof(model.Name));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Mail))
|
||||
{
|
||||
throw new ArgumentNullException("Нет электронной почты",
|
||||
nameof(model.Mail));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.PhoneNumber))
|
||||
{
|
||||
throw new ArgumentNullException("Нет номера телефона",
|
||||
nameof(model.PhoneNumber));
|
||||
}
|
||||
if (string.IsNullOrEmpty(model.Password))
|
||||
{
|
||||
throw new ArgumentNullException("Нет пароля пользователя",
|
||||
nameof(model.Password));
|
||||
}
|
||||
_logger.LogInformation("User. UserName:{UserName}.Birthdate:{ BirthDate}. Mail:{ Mail}. PhoneNumber{ PhoneNumber} Id: { Id}", model.Name, model.BirthDate, model.Mail, model.PhoneNumber, model.Id);
|
||||
var element = _UserStorage.GetElement(new UserSearchModel
|
||||
{
|
||||
Name = model.Name
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Пользователь с таким именем уже есть");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
17
School/SchoolBusinessLogic/SchoolBusinessLogic.csproj
Normal file
17
School/SchoolBusinessLogic/SchoolBusinessLogic.csproj
Normal file
@ -0,0 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SchoolContracts\SchoolContracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,20 @@
|
||||
using SchoolDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.BindingModels
|
||||
{
|
||||
public class AchievementBindingModel : IAchievementModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int LessonId { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
public DateTime ReceiptDate { get; set; }
|
||||
}
|
||||
}
|
22
School/SchoolContracts/BindingModels/InterestBindingModel.cs
Normal file
22
School/SchoolContracts/BindingModels/InterestBindingModel.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SchoolDataModels.Models;
|
||||
|
||||
namespace SchoolContracts.BindingModels
|
||||
{
|
||||
public class InterestBindingModel : IInterestModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Direction { get; set; } = string.Empty;
|
||||
public string Discription { get; set; } = string.Empty;
|
||||
public Dictionary<int, (ILessonModel, int)> InterestLessons
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = new();
|
||||
}
|
||||
}
|
21
School/SchoolContracts/BindingModels/LessonBindingModel.cs
Normal file
21
School/SchoolContracts/BindingModels/LessonBindingModel.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using SchoolDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.BindingModels
|
||||
{
|
||||
public class LessonBindingModel : ILessonModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int UserId { get; set; }
|
||||
|
||||
public DateTime TimeStart { get; set; }
|
||||
|
||||
public DateTime TimeEnd { get; set; }
|
||||
|
||||
}
|
||||
}
|
24
School/SchoolContracts/BindingModels/UserBindingModel.cs
Normal file
24
School/SchoolContracts/BindingModels/UserBindingModel.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SchoolDataModels.Models;
|
||||
|
||||
|
||||
namespace SchoolContracts.BindingModels
|
||||
{
|
||||
public class UserBindingModel : IUserModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
public DateTime BirthDate { get; set; }
|
||||
|
||||
public string Mail { get; set; } = string.Empty;
|
||||
|
||||
public string PhoneNumber { get; set; } = string.Empty;
|
||||
|
||||
public string Password { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IAchievementLogic
|
||||
{
|
||||
List<AchievementViewModel>? ReadList(AchievementSearchModel? model);
|
||||
AchievementViewModel? ReadElement(AchievementSearchModel model);
|
||||
bool Create(AchievementBindingModel model);
|
||||
bool Update(AchievementBindingModel model);
|
||||
bool Delete(AchievementBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface IInterestLogic
|
||||
{
|
||||
List<InterestViewModel>? ReadList(InterestSearchModel? model);
|
||||
InterestViewModel? ReadElement(InterestSearchModel model);
|
||||
bool Create(InterestBindingModel model);
|
||||
bool Update(InterestBindingModel model);
|
||||
bool Delete(InterestBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.BusinessLogicsContracts
|
||||
{
|
||||
public interface ILessonLogic
|
||||
{
|
||||
List<LessonViewModel>? ReadList(LessonSearchModel? model);
|
||||
LessonViewModel? ReadElement(LessonSearchModel model);
|
||||
bool Create(LessonBindingModel model);
|
||||
bool Update(LessonBindingModel model);
|
||||
bool Delete(LessonBindingModel model);
|
||||
}
|
||||
}
|
20
School/SchoolContracts/BusinessLogicsContracts/IUserLogic.cs
Normal file
20
School/SchoolContracts/BusinessLogicsContracts/IUserLogic.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.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);
|
||||
}
|
||||
}
|
13
School/SchoolContracts/SchoolContracts.csproj
Normal file
13
School/SchoolContracts/SchoolContracts.csproj
Normal 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="..\SchoolsDataModels\SchoolDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.SearchModels
|
||||
{
|
||||
public class AchievementSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
}
|
14
School/SchoolContracts/SearchModels/InterestSearchModel.cs
Normal file
14
School/SchoolContracts/SearchModels/InterestSearchModel.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.SearchModels
|
||||
{
|
||||
public class InterestSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
}
|
13
School/SchoolContracts/SearchModels/LessonSearchModel.cs
Normal file
13
School/SchoolContracts/SearchModels/LessonSearchModel.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.SearchModels
|
||||
{
|
||||
public class LessonSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
}
|
14
School/SchoolContracts/SearchModels/UserSearchModel.cs
Normal file
14
School/SchoolContracts/SearchModels/UserSearchModel.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.SearchModels
|
||||
{
|
||||
public class UserSearchModel
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.StoragesContracts
|
||||
{
|
||||
public interface IAchievementStorage
|
||||
{
|
||||
List<AchievementViewModel> GetFullList();
|
||||
List<AchievementViewModel> GetFilteredList(AchievementSearchModel model);
|
||||
AchievementViewModel? GetElement(AchievementSearchModel model);
|
||||
AchievementViewModel? Insert(AchievementBindingModel model);
|
||||
AchievementViewModel? Update(AchievementBindingModel model);
|
||||
AchievementViewModel? Delete(AchievementBindingModel model);
|
||||
}
|
||||
}
|
21
School/SchoolContracts/StoragesContracts/IInterestStorage.cs
Normal file
21
School/SchoolContracts/StoragesContracts/IInterestStorage.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.StoragesContracts
|
||||
{
|
||||
public interface IInterestStorage
|
||||
{
|
||||
List<InterestViewModel> GetFullList();
|
||||
List<InterestViewModel> GetFilteredList(InterestSearchModel model);
|
||||
InterestViewModel? GetElement(InterestSearchModel model);
|
||||
InterestViewModel? Insert(InterestBindingModel model);
|
||||
InterestViewModel? Update(InterestBindingModel model);
|
||||
InterestViewModel? Delete(InterestBindingModel model);
|
||||
}
|
||||
}
|
21
School/SchoolContracts/StoragesContracts/ILessonStorage.cs
Normal file
21
School/SchoolContracts/StoragesContracts/ILessonStorage.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.StoragesContracts
|
||||
{
|
||||
public interface ILessonStorage
|
||||
{
|
||||
List<LessonViewModel> GetFullList();
|
||||
List<LessonViewModel> GetFilteredList(LessonSearchModel model);
|
||||
LessonViewModel? GetElement(LessonSearchModel model);
|
||||
LessonViewModel? Insert(LessonBindingModel model);
|
||||
LessonViewModel? Update(LessonBindingModel model);
|
||||
LessonViewModel? Delete(LessonBindingModel model);
|
||||
}
|
||||
}
|
21
School/SchoolContracts/StoragesContracts/IUserStorage.cs
Normal file
21
School/SchoolContracts/StoragesContracts/IUserStorage.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using SchoolContracts.BindingModels;
|
||||
using SchoolContracts.SearchModels;
|
||||
using SchoolContracts.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolContracts.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);
|
||||
}
|
||||
}
|
22
School/SchoolContracts/ViewModels/AchievementViewModel.cs
Normal file
22
School/SchoolContracts/ViewModels/AchievementViewModel.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using SchoolDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace SchoolContracts.ViewModels
|
||||
{
|
||||
public class AchievementViewModel : IAchievementModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int LessonId { get; set; }
|
||||
[DisplayName("Название достижения")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[DisplayName("Описание достижения")]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
[DisplayName("Дата время получения")]
|
||||
public DateTime ReceiptDate { get; set; }
|
||||
}
|
||||
}
|
26
School/SchoolContracts/ViewModels/InterestViewModel.cs
Normal file
26
School/SchoolContracts/ViewModels/InterestViewModel.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using SchoolDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace SchoolContracts.ViewModels
|
||||
{
|
||||
public class InterestViewModel : IInterestModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Название интереса")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[DisplayName("Направление интереса")]
|
||||
public string Direction { get; set; } = string.Empty;
|
||||
[DisplayName("Описание интереса")]
|
||||
public string Discription { get; set; } = string.Empty;
|
||||
public Dictionary<int, (ILessonModel, int)> InterestLessons
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = new();
|
||||
}
|
||||
}
|
20
School/SchoolContracts/ViewModels/LessonViewModel.cs
Normal file
20
School/SchoolContracts/ViewModels/LessonViewModel.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using SchoolDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace SchoolContracts.ViewModels
|
||||
{
|
||||
public class LessonViewModel : ILessonModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int UserId { get; set; }
|
||||
[DisplayName("Время начала занятие")]
|
||||
public DateTime TimeStart { get; set; }
|
||||
[DisplayName("Время конца занятия")]
|
||||
public DateTime TimeEnd { get; set; }
|
||||
}
|
||||
}
|
24
School/SchoolContracts/ViewModels/UserViewModel.cs
Normal file
24
School/SchoolContracts/ViewModels/UserViewModel.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using SchoolDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace SchoolContracts.ViewModels
|
||||
{
|
||||
public class UserViewModel : IUserModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Имя пользователя")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[DisplayName("Дата рождения")]
|
||||
public DateTime BirthDate { get; set; }
|
||||
[DisplayName("Электронная почта")]
|
||||
public string Mail { get; set; } = string.Empty;
|
||||
[DisplayName("Номер телефона")]
|
||||
public string PhoneNumber { get; set; } = string.Empty;
|
||||
public string Password { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
14
School/SchoolsDataModels/IId.cs
Normal file
14
School/SchoolsDataModels/IId.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolDataModels
|
||||
{
|
||||
public interface IId
|
||||
{
|
||||
int Id { get; }
|
||||
|
||||
}
|
||||
}
|
16
School/SchoolsDataModels/Models/IAchievementModel.cs
Normal file
16
School/SchoolsDataModels/Models/IAchievementModel.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolDataModels.Models
|
||||
{
|
||||
public interface IAchievementModel : IId
|
||||
{
|
||||
int LessonId { get; }
|
||||
string Name { get; }
|
||||
string Description { get; }
|
||||
DateTime ReceiptDate { get; }
|
||||
}
|
||||
}
|
19
School/SchoolsDataModels/Models/IInterestModel.cs
Normal file
19
School/SchoolsDataModels/Models/IInterestModel.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolDataModels.Models
|
||||
{
|
||||
public interface IInterestModel : IId
|
||||
{
|
||||
string Name { get; }
|
||||
|
||||
string Direction { get; }
|
||||
|
||||
string Discription { get; }
|
||||
|
||||
Dictionary<int, (ILessonModel, int)> InterestLessons { get; }
|
||||
}
|
||||
}
|
15
School/SchoolsDataModels/Models/ILessonModel.cs
Normal file
15
School/SchoolsDataModels/Models/ILessonModel.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolDataModels.Models
|
||||
{
|
||||
public interface ILessonModel : IId
|
||||
{
|
||||
int UserId { get; }
|
||||
DateTime TimeStart { get; }
|
||||
DateTime TimeEnd { get; }
|
||||
}
|
||||
}
|
17
School/SchoolsDataModels/Models/IUserModel.cs
Normal file
17
School/SchoolsDataModels/Models/IUserModel.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchoolDataModels.Models
|
||||
{
|
||||
public interface IUserModel : IId
|
||||
{
|
||||
string Name { get; }
|
||||
DateTime BirthDate { get; }
|
||||
string Mail { get; }
|
||||
string PhoneNumber { get; }
|
||||
string Password { get; }
|
||||
}
|
||||
}
|
9
School/SchoolsDataModels/SchoolDataModels.csproj
Normal file
9
School/SchoolsDataModels/SchoolDataModels.csproj
Normal file
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user