-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathCourseFilterUtils.cs
More file actions
29 lines (27 loc) · 950 Bytes
/
CourseFilterUtils.cs
File metadata and controls
29 lines (27 loc) · 950 Bytes
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
using System.Collections.Generic;
using HwProj.CoursesService.API.Models;
using HwProj.Models.CoursesService;
namespace HwProj.CoursesService.API.Services
{
public static class CourseFilterUtils
{
public static Filter CreateFilter(CreateCourseFilterModel courseFilterModel)
{
return new Filter
{
GroupIds = courseFilterModel.GroupIds,
HomeworkIds = courseFilterModel.HomeworkIds,
MentorIds = courseFilterModel.MentorIds,
StudentIds = courseFilterModel.StudentIds
}.FillEmptyFields();
}
public static Filter FillEmptyFields(this Filter filter)
{
filter.GroupIds ??= new List<long>();
filter.StudentIds ??= new List<string>();
filter.HomeworkIds ??= new List<long>();
filter.MentorIds ??= new List<string>();
return filter;
}
}
}