This commit is contained in:
Userok 2024-11-08 09:59:01 +03:00
parent 6cd68fd8f8
commit f5681a2bef
10 changed files with 94 additions and 17 deletions

View File

@ -1,6 +1,7 @@
using System.Diagnostics;
using Zurnal.RemaDateBase.DateDao;
using System.Text.RegularExpressions;
using Zurnal.domain.Models;
namespace Zurnal.Data.Repository
{
@ -76,5 +77,10 @@ public bool UpdateGroupById(int groupId, GroupDao updatedGroup)
{
return AllGroup.FirstOrDefault(g => g.Id == groupId);
}
}
public List<GroupLocalEntity> GetAllGroup()
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using Zurnal.RemaDateBase.DateDao;
[DebuggerDisplay($"{{{nameof(GetDebuggerDisplay)}(),nq}}")]
public class PresenceRepositoryIml : IPresenceRepository
{
private readonly List<PresnceDao> _presences = new List<PresnceDao>();
public void AddPresence(PresnceDao presence)
{
_presences.Add(presence);
}
public PresnceDao GetPresenceById(int id)
{
return _presences.Find(p => p.LessonNumber == id);
}
public IEnumerable<PresnceDao> GetAllPresences()
{
return _presences;
}
public void UpdatePresence(PresnceDao presence)
{
var existingPresence = GetPresenceById(presence.LessonNumber);
if (existingPresence != null)
{
existingPresence.UserGuid = presence.UserGuid;
existingPresence.IsAttendensy = presence.IsAttendensy;
existingPresence.Date = presence.Date;
existingPresence.userDao = presence.userDao;
}
}
public void DeletePresence(int id)
{
var presence = GetPresenceById(id);
if (presence != null)
{
_presences.Remove(presence);
}
}
private string GetDebuggerDisplay()
{
return ToString();
}
}

View File

@ -5,7 +5,7 @@ using Zurnal.RemaDateBase.DateDao;
namespace Zurnal.Data.Repository
{
public class UserRepositoryImpl : IGroupRepository
public class UserRepositoryImpl : IUserRepository
{
public UserRepositoryImpl() => GetAllUsers = LocalStaticData.users;
@ -40,9 +40,10 @@ namespace Zurnal.Data.Repository
return userLocal;
}
public List<UserLocalEnity> GetAllUsersList()
public List<UserLocalEnity> GetAllUsersList()
{
return GetAllUsers;
}
}
}

View File

@ -1,13 +1,18 @@
using Zurnal.Data.Repository;
using Zurnal.domain.Models;
using Zurnal.RemaDateBase.DateDao;
namespace Zurnal.Domain.UseCase
{
public class UserUseCase : IGroupRepository
public class UserUseCase : IUserRepository
{
private readonly UserRepositoryImpl _repositoryUserImpl;
internal IGroupRepository RepositoryGroupImpl { get; }
List<UserLocalEnity> IUserRepository.GetAllUsers => throw new NotImplementedException();
public List<GroupDao> AllGroup => throw new NotImplementedException();
public UserUseCase(UserRepositoryImpl repositoryImpl, GroupRepositoryImpl repositoryGroupImpl)
{
_repositoryUserImpl = repositoryImpl;
@ -54,8 +59,16 @@ namespace Zurnal.Domain.UseCase
return new UserDao { FIO = user.FIO, UserGuid = user.Guid, Group = group, GroupID = group.Id };
}
public List<GroupDao> AllGroup => RepositoryGroupImpl.AllGroup.ToList();
List<GroupDao> IGroupRepository.AllGroup => throw new NotImplementedException();
public UserLocalEnity? GetUserByGuid(Guid userGuid)
{
throw new NotImplementedException();
}
public UserLocalEnity? UpdateUser(UserLocalEnity userUpdateLocalEnity)
{
throw new NotImplementedException();
}
internal class UserLocalEntity
{
public string FIO { get; set; }

View File

View File

@ -1,10 +1,16 @@
using System;
using System.Collections.Generic;
using Zurnal.domain.Models;
using Zurnal.RemaDateBase.DateDao;
public interface IUserRepository
namespace Zurnal.Data.Repository
{
void AddUser(User user);
User GetUserById(int id);
IEnumerable<User> GetAllUsers();
void UpdateUser(User user);
void DeleteUser(int id);
public interface IUserRepository
{
List<UserLocalEnity> GetAllUsers { get; }
List<GroupDao> AllGroup { get; }
bool RemoveUserByGuid(Guid userGuid);
UserLocalEnity? GetUserByGuid(Guid userGuid);
UserLocalEnity? UpdateUser(UserLocalEnity userUpdateLocalEnity);
}
}

View File

@ -13,10 +13,10 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Zurnal")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+cefc9b3a85c12cb82d7e543ab8d2eb025849b9ec")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+6cd68fd8f848f82dab9dfb3c0fa57e7014aa5697")]
[assembly: System.Reflection.AssemblyProductAttribute("Zurnal")]
[assembly: System.Reflection.AssemblyTitleAttribute("Zurnal")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.
// Создано классом WriteCodeFragment MSBuild.

View File

@ -1 +1 @@
e861d9be05b9445b3ebef44d26117a8c4b30fb141208d42302beba8abc1372c1
c331eb4bc703cef79f6ccb4af78678a11ffab66ac92df33af549b62ed2206c81

View File

@ -1 +1 @@
e818c2582926724344d87f9300781db10e3c61b91dde2011ab5210bca4cb8741
455f82408edc8de19a04e05dad7dd15bf55e5478b4c07225e67f3aa0f3e97c48