| | 1 | | using MUNity.Database.Models.Conference; |
| | 2 | | using MUNity.Database.Models.Organization; |
| | 3 | | using MUNity.Schema.Conference; |
| | 4 | | using MUNity.Schema.Organization; |
| | 5 | | using System.Linq; |
| | 6 | |
|
| | 7 | | namespace MUNity.Services.Extensions.CastExtensions; |
| | 8 | |
|
| | 9 | | public static class ConferenceSructureCast |
| | 10 | | { |
| | 11 | |
|
| | 12 | | public static CommitteeSmallInfo AsSmallInfo(this Committee committee) |
| 0 | 13 | | { |
| 0 | 14 | | var info = new CommitteeSmallInfo() |
| 0 | 15 | | { |
| 0 | 16 | | CommitteeId = committee.CommitteeId, |
| 0 | 17 | | CommitteeShort = committee.CommitteeShort, |
| 0 | 18 | | FullName = committee.FullName, |
| 0 | 19 | | Name = committee.Name |
| 0 | 20 | | }; |
| 0 | 21 | | return info; |
| 0 | 22 | | } |
| | 23 | |
|
| | 24 | | public static ConferenceInformation AsConferenceInformation(this Conference conference) |
| 0 | 25 | | { |
| 0 | 26 | | var info = new ConferenceInformation() |
| 0 | 27 | | { |
| 0 | 28 | | ConferenceId = conference.ConferenceId, |
| 0 | 29 | | ConferenceShort = conference.ConferenceShort, |
| 0 | 30 | | EndDate = conference.EndDate, |
| 0 | 31 | | FullName = conference.FullName, |
| 0 | 32 | | Name = conference.Name, |
| 0 | 33 | | StartDate = conference.StartDate |
| 0 | 34 | | }; |
| | 35 | |
|
| 0 | 36 | | if (conference.ConferenceProject != null) |
| 0 | 37 | | info.ProjectId = conference.ConferenceProject.ProjectId; |
| | 38 | |
|
| 0 | 39 | | if (conference.Committees != null) |
| 0 | 40 | | info.Committees = conference.Committees.Select(n => n.AsSmallInfo()); |
| | 41 | |
|
| 0 | 42 | | return info; |
| 0 | 43 | | } |
| | 44 | |
|
| | 45 | | public static OrganizationInformation AsInformation(this Organization organization) |
| 0 | 46 | | { |
| 0 | 47 | | var mdl = new OrganizationInformation() |
| 0 | 48 | | { |
| 0 | 49 | | OrganizationId = organization.OrganizationId, |
| 0 | 50 | | OrganizationName = organization.OrganizationName, |
| 0 | 51 | | OrganizationShort = organization.OrganizationShort |
| 0 | 52 | | }; |
| 0 | 53 | | return mdl; |
| 0 | 54 | | } |
| | 55 | | } |