-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathCourseViewModels.cs
More file actions
78 lines (67 loc) · 2.69 KB
/
CourseViewModels.cs
File metadata and controls
78 lines (67 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using HwProj.Models.AuthService.DTO;
using HwProj.Models.CoursesService.DTO;
namespace HwProj.Models.CoursesService.ViewModels
{
public class CreateCourseViewModel
{
[Required]
[RegularExpression(@"^\S+.*", ErrorMessage = "Name shouldn't start with white spaces.")]
public string Name { get; set; }
public List<string> GroupNames { get; set; } = new List<string>();
public List<string> StudentIDs { get; set; } = new List<string>();
public bool FetchStudents { get; set; }
[Required] public bool IsOpen { get; set; }
public long? BaseCourseId { get; set; }
}
public class UpdateCourseViewModel
{
[Required]
[RegularExpression(@"^\S+.*", ErrorMessage = "Name shouldn't start with white spaces.")]
public string Name { get; set; }
public string GroupName { get; set; }
[Required] public bool IsOpen { get; set; }
public bool IsCompleted { get; set; }
}
public class CourseDTO : CoursePreview
{
public bool IsOpen { get; set; }
public string InviteCode { get; set; }
public CourseMateViewModel[] CourseMates { get; set; }
public HomeworkViewModel[] Homeworks { get; set; }
public GroupViewModel[] Groups { get; set; } = Array.Empty<GroupViewModel>();
public IEnumerable<CourseMateViewModel> AcceptedStudents => CourseMates.Where(t => t.IsAccepted);
public IEnumerable<CourseMateViewModel> NewStudents => CourseMates.Where(t => !t.IsAccepted);
}
public class CourseViewModel
{
public long Id { get; set; }
public string Name { get; set; }
public string GroupName { get; set; }
public bool IsOpen { get; set; }
public bool IsCompleted { get; set; }
public GroupViewModel[] Groups { get; set; }
public AccountDataDto[] Mentors { get; set; }
public AccountDataDto[] AcceptedStudents { get; set; }
public AccountDataDto[] NewStudents { get; set; }
public HomeworkViewModel[] Homeworks { get; set; }
}
public class CourseAllData
{
public CourseViewModel Course { get; set; }
public MentorToAssignedStudentsDTO[] AssignedStudents { get; set; }
}
// Модель для списка всех курсов
public class CoursePreview
{
public long Id { get; set; }
public string Name { get; set; }
public string GroupName { get; set; }
public bool IsCompleted { get; set; }
public string[] MentorIds { get; set; }
public long? TaskId { get; set; }
}
}