Compare commits
No commits in common. "4105b8029769b2ea442771dc29b948bad308afc9" and "b74b626fe07a96e3b6a172214a8a4d557f5c7f79" have entirely different histories.
4105b80297
...
b74b626fe0
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
@ -10,76 +9,24 @@ using Posechaemost.Data.LocalData.Entity;
|
||||
|
||||
namespace Posechaemost.Data.Repository
|
||||
{
|
||||
public class GroupRepositoryImpl: IGroupRepository
|
||||
public class GroupRepositoryImpl
|
||||
{
|
||||
|
||||
public bool AddGroup(String name, String id)
|
||||
{
|
||||
GroupLocalEntity? groupLocal = GetAllGroups().FirstOrDefault();
|
||||
// GroupLocalEntity? group = new GroupLocalEntity();
|
||||
groupLocal.Name = name;
|
||||
groupLocal.Id = int.Parse(id);
|
||||
return true;
|
||||
}
|
||||
|
||||
public List<GroupLocalEntity> GetAllGroup()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public List<GroupLocalEntity> GetAllGroups() => LocalStaticData.groups;
|
||||
|
||||
public GroupLocalEntity GetGroupById(int groupID)
|
||||
public GroupLocalEntity? UpdateGroup(String name)
|
||||
{
|
||||
GroupLocalEntity groupLocal = GetAllGroups()
|
||||
.Where(x => x.Id == groupID).FirstOrDefault();
|
||||
GroupLocalEntity? groupLocal = GetAllGroups()
|
||||
.Where(x => x.Name == name).FirstOrDefault();
|
||||
if (groupLocal == null) return null;
|
||||
groupLocal.Name = name;
|
||||
return groupLocal;
|
||||
}
|
||||
|
||||
public bool RemoveGroupById(int groupID){
|
||||
GroupLocalEntity? groupLocal = GetAllGroups()
|
||||
.Where(x => x.Id == groupID).FirstOrDefault();
|
||||
if (groupLocal == null) return false;
|
||||
|
||||
return GetAllGroups().Remove(groupLocal);
|
||||
}
|
||||
// public GroupLocalEntity? AddGroup(String name, String id) //не работает
|
||||
// {
|
||||
// GroupLocalEntity? groupLocal = GetAllGroups()
|
||||
// .Where(x => x.Id == groupID).FirstOrDefault();
|
||||
// if (groupLocal == null) return false;
|
||||
|
||||
// return GetAllGroups().Remove(groupLocal);
|
||||
// }
|
||||
|
||||
public bool UpdateGroupById(int groupID, String name)
|
||||
public GroupLocalEntity? AddGroup(String name, String id) //не работает корректно
|
||||
{
|
||||
GroupLocalEntity? groupLocal = GetAllGroups()
|
||||
.Where(x => x.Id == groupID).FirstOrDefault();
|
||||
if (groupLocal == null) return false;
|
||||
GroupLocalEntity? groupLocal = GetAllGroups().FirstOrDefault();
|
||||
groupLocal.Name = name;
|
||||
return true;
|
||||
groupLocal.Id = int.Parse(id);
|
||||
return groupLocal;
|
||||
}
|
||||
}
|
||||
}
|
||||
// {
|
||||
// public List<GroupLocalEntity> GetAllGroups() => LocalStaticData.groups;
|
||||
// public GroupLocalEntity? UpdateGroup(String name)
|
||||
// {
|
||||
// GroupLocalEntity? groupLocal = GetAllGroups()
|
||||
// .Where(x => x.Name == name).FirstOrDefault();
|
||||
// if (groupLocal == null) return null;
|
||||
// groupLocal.Name = name;
|
||||
// return groupLocal;
|
||||
// }
|
||||
|
||||
// public GroupLocalEntity? AddGroup(String name, String id)
|
||||
// {
|
||||
// GroupLocalEntity? groupLocal = GetAllGroups().FirstOrDefault();
|
||||
// // GroupLocalEntity? group = new GroupLocalEntity(name, id);
|
||||
// groupLocal.Name = name;
|
||||
// groupLocal.Id = int.Parse(id);
|
||||
// return groupLocal;
|
||||
// }
|
||||
// }
|
@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Posechaemost.Data.LocalData.Entity;
|
||||
|
||||
namespace Posechaemost.Data.Repository {
|
||||
public interface IGroupRepository
|
||||
{
|
||||
List<GroupLocalEntity> GetAllGroup();
|
||||
bool RemoveGroupById(int groupID);
|
||||
bool UpdateGroupById(int groupID, String name);
|
||||
GroupLocalEntity GetGroupById(int groupID);
|
||||
bool AddGroup(String name, String id);
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Posechaemost.Data.LocalData.Entity;
|
||||
|
||||
namespace Posechaemost.Data.Repository {
|
||||
public interface IUserRepository
|
||||
{
|
||||
List<UserLocalEntity> GetAllUser();
|
||||
bool RemoveUserByGuid(Guid userGuid);
|
||||
UserLocalEntity? GetUserByGuid(Guid userGuid);
|
||||
UserLocalEntity? UpdateUser(UserLocalEntity userUpdateLocalEnity);
|
||||
UserLocalEntity? UpdateUserByGuid(Guid userGuid);
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Posechaemost.Data.LocalData;
|
||||
@ -8,18 +9,12 @@ using Posechaemost.Data.LocalData.Entity;
|
||||
|
||||
namespace Posechaemost.Data.Repository
|
||||
{
|
||||
public class UserRepositoryImpl: IUserRepository
|
||||
public class UserRepositoryImpl
|
||||
{
|
||||
public UserRepositoryImpl() {
|
||||
|
||||
GetAllUsers = LocalStaticData.users;
|
||||
}
|
||||
|
||||
public List<UserLocalEntity> GetAllUser()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public List<UserLocalEntity> GetAllUsers
|
||||
{ get; set; }
|
||||
|
||||
|
@ -21,10 +21,14 @@ namespace Posechaemost.Domain.UseCase
|
||||
public List<Group> GetAllGroups() => _repositoryGroupImpl.GetAllGroups()
|
||||
.Select(it => new Group { Id = it.Id, Name = it.Name}).ToList();
|
||||
|
||||
public bool UpdateGroupName(String id, String name1) {
|
||||
return _repositoryGroupImpl.UpdateGroupById(int.Parse(id), name1);
|
||||
public Group UpdateGroupName(String name, String name1) {
|
||||
GroupLocalEntity? result = _repositoryGroupImpl.UpdateGroup(name);
|
||||
if (result == null) throw new Exception("");
|
||||
Group? group = GetAllGroups().FirstOrDefault(it => it.Name == result.Name);
|
||||
if (group == null) throw new Exception("");
|
||||
return new Group {Id = group.Id, Name = name1};
|
||||
}
|
||||
public bool AddGroup(String name, String id)
|
||||
public GroupLocalEntity AddGroup(String name, String id)
|
||||
{
|
||||
return _repositoryGroupImpl.AddGroup(name, id);
|
||||
}
|
||||
|
@ -11,9 +11,8 @@ namespace Posechaemost.Domain.UseCase
|
||||
{
|
||||
public class UserUseCase
|
||||
{
|
||||
|
||||
private readonly UserRepositoryImpl _repositoryUserImpl;
|
||||
private readonly IGroupRepository _repositoryGroupImpl;
|
||||
private UserRepositoryImpl _repositoryUserImpl;
|
||||
private GroupRepositoryImpl _repositoryGroupImpl;
|
||||
|
||||
public UserUseCase(UserRepositoryImpl repositoryImpl, GroupRepositoryImpl repositoryGroupImpl)
|
||||
{
|
||||
@ -21,10 +20,10 @@ namespace Posechaemost.Domain.UseCase
|
||||
_repositoryGroupImpl = repositoryGroupImpl;
|
||||
}
|
||||
|
||||
private List<Group> GetAllGroups() => _repositoryGroupImpl.GetAllGroup()
|
||||
public List<Group> GetAllGroups() => _repositoryGroupImpl.GetAllGroups()
|
||||
.Select(it => new Group { Id = it.Id, Name = it.Name}).ToList();
|
||||
public List<User> GetAllUsers() => _repositoryUserImpl.GetAllUsers
|
||||
.Join(_repositoryGroupImpl.GetAllGroup(),
|
||||
.Join(_repositoryGroupImpl.GetAllGroups(),
|
||||
user => user.GroupID,
|
||||
group => group.Id,
|
||||
(user, group) =>
|
||||
|
@ -7,8 +7,4 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
13
Program.cs
13
Program.cs
@ -1,19 +1,10 @@
|
||||
using Posechaemost.Data.Repository;
|
||||
using Posechaemost.Domain.UseCase;
|
||||
using Posechaemost.UI;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
IServiceCollection services = new ServiceCollection();
|
||||
|
||||
services
|
||||
.AddSingleton<IGroupRepository, GroupRepositoryImpl>()
|
||||
.AddSingleton<UserUseCase>();
|
||||
|
||||
var serviceProvider = services.BuildServiceProvider();
|
||||
|
||||
GroupRepositoryImpl groupRepositoryImpl = new GroupRepositoryImpl();
|
||||
UserUseCase userUseCase = serviceProvider.GetService<UserUseCase>();
|
||||
UserRepositoryImpl userRepositoryImpl = new UserRepositoryImpl();
|
||||
UserUseCase userUseCase = new UserUseCase(userRepositoryImpl, groupRepositoryImpl);
|
||||
GroupUseCase groupUseCase = new GroupUseCase(groupRepositoryImpl);
|
||||
|
||||
MainMenuUI mainMenuUI = new MainMenuUI(userUseCase, groupUseCase);
|
@ -13,10 +13,10 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Posechaemost")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+36a123355e04422229f0afaff5d2c6d503a8419e")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1305f40f241ce752d3c0a7ec5341b1eafac497d8")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("Posechaemost")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("Posechaemost")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Generated by the MSBuild WriteCodeFragment class.
|
||||
// Создано классом WriteCodeFragment MSBuild.
|
||||
|
||||
|
@ -1 +1 @@
|
||||
c78a5718d92cc56f307f18b87610c16cd6bd4adb899ce2e54039bee5d3d6ceb2
|
||||
7a59f60438c72dd05578b09f953c9ba9d3343469014f076958deeba098123188
|
||||
|
Binary file not shown.
Binary file not shown.
@ -42,12 +42,6 @@
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
"target": "Package",
|
||||
"version": "[8.0.1, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
|
@ -1,114 +1,11 @@
|
||||
{
|
||||
"version": 3,
|
||||
"targets": {
|
||||
"net8.0": {
|
||||
"Microsoft.Extensions.DependencyInjection/8.0.1": {
|
||||
"type": "package",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.2"
|
||||
},
|
||||
"compile": {
|
||||
"lib/net8.0/Microsoft.Extensions.DependencyInjection.dll": {
|
||||
"related": ".xml"
|
||||
}
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net8.0/Microsoft.Extensions.DependencyInjection.dll": {
|
||||
"related": ".xml"
|
||||
}
|
||||
},
|
||||
"build": {
|
||||
"buildTransitive/net6.0/_._": {}
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions/8.0.2": {
|
||||
"type": "package",
|
||||
"compile": {
|
||||
"lib/net8.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll": {
|
||||
"related": ".xml"
|
||||
}
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net8.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll": {
|
||||
"related": ".xml"
|
||||
}
|
||||
},
|
||||
"build": {
|
||||
"buildTransitive/net6.0/_._": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"Microsoft.Extensions.DependencyInjection/8.0.1": {
|
||||
"sha512": "BmANAnR5Xd4Oqw7yQ75xOAYODybZQRzdeNucg7kS5wWKd2PNnMdYtJ2Vciy0QLylRmv42DGl5+AFL9izA6F1Rw==",
|
||||
"type": "package",
|
||||
"path": "microsoft.extensions.dependencyinjection/8.0.1",
|
||||
"files": [
|
||||
".nupkg.metadata",
|
||||
".signature.p7s",
|
||||
"Icon.png",
|
||||
"LICENSE.TXT",
|
||||
"PACKAGE.md",
|
||||
"THIRD-PARTY-NOTICES.TXT",
|
||||
"buildTransitive/net461/Microsoft.Extensions.DependencyInjection.targets",
|
||||
"buildTransitive/net462/_._",
|
||||
"buildTransitive/net6.0/_._",
|
||||
"buildTransitive/netcoreapp2.0/Microsoft.Extensions.DependencyInjection.targets",
|
||||
"lib/net462/Microsoft.Extensions.DependencyInjection.dll",
|
||||
"lib/net462/Microsoft.Extensions.DependencyInjection.xml",
|
||||
"lib/net6.0/Microsoft.Extensions.DependencyInjection.dll",
|
||||
"lib/net6.0/Microsoft.Extensions.DependencyInjection.xml",
|
||||
"lib/net7.0/Microsoft.Extensions.DependencyInjection.dll",
|
||||
"lib/net7.0/Microsoft.Extensions.DependencyInjection.xml",
|
||||
"lib/net8.0/Microsoft.Extensions.DependencyInjection.dll",
|
||||
"lib/net8.0/Microsoft.Extensions.DependencyInjection.xml",
|
||||
"lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.dll",
|
||||
"lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.xml",
|
||||
"lib/netstandard2.1/Microsoft.Extensions.DependencyInjection.dll",
|
||||
"lib/netstandard2.1/Microsoft.Extensions.DependencyInjection.xml",
|
||||
"microsoft.extensions.dependencyinjection.8.0.1.nupkg.sha512",
|
||||
"microsoft.extensions.dependencyinjection.nuspec",
|
||||
"useSharedDesignerContext.txt"
|
||||
]
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection.Abstractions/8.0.2": {
|
||||
"sha512": "3iE7UF7MQkCv1cxzCahz+Y/guQbTqieyxyaWKhrRO91itI9cOKO76OHeQDahqG4MmW5umr3CcCvGmK92lWNlbg==",
|
||||
"type": "package",
|
||||
"path": "microsoft.extensions.dependencyinjection.abstractions/8.0.2",
|
||||
"files": [
|
||||
".nupkg.metadata",
|
||||
".signature.p7s",
|
||||
"Icon.png",
|
||||
"LICENSE.TXT",
|
||||
"PACKAGE.md",
|
||||
"THIRD-PARTY-NOTICES.TXT",
|
||||
"buildTransitive/net461/Microsoft.Extensions.DependencyInjection.Abstractions.targets",
|
||||
"buildTransitive/net462/_._",
|
||||
"buildTransitive/net6.0/_._",
|
||||
"buildTransitive/netcoreapp2.0/Microsoft.Extensions.DependencyInjection.Abstractions.targets",
|
||||
"lib/net462/Microsoft.Extensions.DependencyInjection.Abstractions.dll",
|
||||
"lib/net462/Microsoft.Extensions.DependencyInjection.Abstractions.xml",
|
||||
"lib/net6.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll",
|
||||
"lib/net6.0/Microsoft.Extensions.DependencyInjection.Abstractions.xml",
|
||||
"lib/net7.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll",
|
||||
"lib/net7.0/Microsoft.Extensions.DependencyInjection.Abstractions.xml",
|
||||
"lib/net8.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll",
|
||||
"lib/net8.0/Microsoft.Extensions.DependencyInjection.Abstractions.xml",
|
||||
"lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll",
|
||||
"lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.Abstractions.xml",
|
||||
"lib/netstandard2.1/Microsoft.Extensions.DependencyInjection.Abstractions.dll",
|
||||
"lib/netstandard2.1/Microsoft.Extensions.DependencyInjection.Abstractions.xml",
|
||||
"microsoft.extensions.dependencyinjection.abstractions.8.0.2.nupkg.sha512",
|
||||
"microsoft.extensions.dependencyinjection.abstractions.nuspec",
|
||||
"useSharedDesignerContext.txt"
|
||||
]
|
||||
}
|
||||
"net8.0": {}
|
||||
},
|
||||
"libraries": {},
|
||||
"projectFileDependencyGroups": {
|
||||
"net8.0": [
|
||||
"Microsoft.Extensions.DependencyInjection >= 8.0.1"
|
||||
]
|
||||
"net8.0": []
|
||||
},
|
||||
"packageFolders": {
|
||||
"/home/gara/.nuget/packages/": {}
|
||||
@ -151,12 +48,6 @@
|
||||
"frameworks": {
|
||||
"net8.0": {
|
||||
"targetAlias": "net8.0",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
"target": "Package",
|
||||
"version": "[8.0.1, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
|
@ -1,11 +1,8 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "JxuWkwCqUKY=",
|
||||
"dgSpecHash": "3K0+oSHYQvE=",
|
||||
"success": true,
|
||||
"projectFilePath": "/home/gara/csharp/Posechaemost/Posechaemost.csproj",
|
||||
"expectedPackageFiles": [
|
||||
"/home/gara/.nuget/packages/microsoft.extensions.dependencyinjection/8.0.1/microsoft.extensions.dependencyinjection.8.0.1.nupkg.sha512",
|
||||
"/home/gara/.nuget/packages/microsoft.extensions.dependencyinjection.abstractions/8.0.2/microsoft.extensions.dependencyinjection.abstractions.8.0.2.nupkg.sha512"
|
||||
],
|
||||
"expectedPackageFiles": [],
|
||||
"logs": []
|
||||
}
|
Loading…
Reference in New Issue
Block a user