using System.ComponentModel.DataAnnotations; using System.Text; using Demo.Domain.Models; using Demo.Domain.UseCase; namespace Demo.UI { public class PresenceConsoleUI{ IPresenceUseCase _presenceUseCase; public PresenceConsoleUI (IPresenceUseCase presenceUseCase){ _presenceUseCase = presenceUseCase; } public void DisplayPresenceByGroup(int groupID){ StringBuilder stringBuilder = new StringBuilder(); foreach(Presence presence in _presenceUseCase.GetPresenceByGroup(groupID)){ stringBuilder.AppendLine($"{presence.User.FIO}, {presence.User.Group.Name}, {presence.IsAttedance}, {presence.Date}, {presence.LessonNumber}"); } Console.WriteLine(stringBuilder); } public void DisplayPresenceByGroupByTime(int groupID, DateOnly date){ StringBuilder stringBuilder = new StringBuilder(); foreach(Presence presence in _presenceUseCase.GetPresenceByGroupByTime(groupID, date)){ stringBuilder.AppendLine($"{presence.User.FIO}, {presence.User.Group.Name}, {presence.IsAttedance}, {presence.Date}, {presence.LessonNumber}"); } Console.WriteLine(stringBuilder); } public void GeneratePresence(int firstLesson, int lastLesson, int groupID, DateOnly date){ string output = _presenceUseCase.GeneratePresence(firstLesson, lastLesson, groupID, date) ? "Сгенерированно" : "Не сгенерированно"; Console.WriteLine(output); } public void GeneratePresenceWeek(int firstLesson, int lastLesson, int groupID, DateOnly date){ string output = _presenceUseCase.GeneratePresenceWeek(firstLesson, lastLesson, groupID, date) ? "Сгенерированно" : "Не сгенерированно"; Console.WriteLine(output); } public void IsAttedance(int firstLesson, int lastLesson, DateOnly date, Guid UserGuid){ string output = _presenceUseCase.IsAttedance(firstLesson, lastLesson, date, UserGuid) ? "Обновлено" : "Не обновлено"; Console.WriteLine(output); } } }