92 lines
3.5 KiB
C#
92 lines
3.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Nexius.IdentityProvider.Model.External.V1;
|
|
|
|
namespace Kreta.BusinessLogic.HelperClasses
|
|
{
|
|
[Serializable]
|
|
public class KretaCourseObjectCo
|
|
{
|
|
public KretaCourseObjectCo() { Children = new List<KretaCourseObjectCo>(); }
|
|
|
|
public KretaCourseObjectCo(CourseObject courseObject)
|
|
{
|
|
Id = courseObject.Id;
|
|
ShortId = courseObject.ShortId;
|
|
Title = courseObject.Title;
|
|
Index = courseObject.Index;
|
|
Description = courseObject.Description;
|
|
Children = ConvertToKretaCourseCoList(courseObject.Children);
|
|
ExemptionForCompleted = courseObject.ExemptionForCompleted;
|
|
ExemptionForSatisfied = courseObject.ExemptionForSatisfied;
|
|
RequiredForCompleted = courseObject.RequiredForCompleted;
|
|
RequiredForSatisfied = courseObject.RequiredForSatisfied;
|
|
IsHidden = courseObject.IsHidden;
|
|
}
|
|
|
|
public Guid Id { get; set; }
|
|
public string ShortId { get; set; }
|
|
public string Title { get; set; }
|
|
public int Index { get; set; }
|
|
public string Description { get; set; }
|
|
public List<KretaCourseObjectCo> Children { get; set; }
|
|
public bool ExemptionForCompleted { get; set; }
|
|
public bool ExemptionForSatisfied { get; set; }
|
|
public bool RequiredForCompleted { get; set; }
|
|
public bool RequiredForSatisfied { get; set; }
|
|
public virtual bool IsHidden { get; set; }
|
|
|
|
public CourseObject ToCourseObject()
|
|
{
|
|
return new CourseObject
|
|
{
|
|
Id = this.Id,
|
|
ShortId = this.ShortId,
|
|
Title = this.Title,
|
|
Index = this.Index,
|
|
Description = this.Description,
|
|
Children = ConvertToKretaCourseCoList(this.Children),
|
|
ExemptionForCompleted = this.ExemptionForCompleted,
|
|
ExemptionForSatisfied = this.ExemptionForSatisfied,
|
|
RequiredForCompleted = this.RequiredForCompleted,
|
|
RequiredForSatisfied = this.RequiredForSatisfied,
|
|
IsHidden = this.IsHidden
|
|
};
|
|
}
|
|
|
|
private static List<KretaCourseObjectCo> ConvertToKretaCourseCoList(List<CourseObject> courseObjectList)
|
|
{
|
|
var result = new List<KretaCourseObjectCo>();
|
|
foreach (var courseObject in courseObjectList)
|
|
{
|
|
result.Add(new KretaCourseObjectCo(courseObject));
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
private static List<CourseObject> ConvertToKretaCourseCoList(List<KretaCourseObjectCo> courseObjectList)
|
|
{
|
|
var result = new List<CourseObject>();
|
|
foreach (var item in courseObjectList)
|
|
{
|
|
result.Add(new CourseObject
|
|
{
|
|
Id = item.Id,
|
|
ShortId = item.ShortId,
|
|
Title = item.Title,
|
|
Index = item.Index,
|
|
Description = item.Description,
|
|
Children = ConvertToKretaCourseCoList(item.Children),
|
|
ExemptionForCompleted = item.ExemptionForCompleted,
|
|
ExemptionForSatisfied = item.ExemptionForSatisfied,
|
|
RequiredForCompleted = item.RequiredForCompleted,
|
|
RequiredForSatisfied = item.RequiredForSatisfied,
|
|
IsHidden = item.IsHidden
|
|
});
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
}
|