Skip to content

Commit

Permalink
Adds FreeLessonTimespanData
Browse files Browse the repository at this point in the history
  • Loading branch information
frostieDE committed Aug 15, 2020
1 parent 9b385c9 commit 07a5a17
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions IccImport/IIccImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,7 @@ public interface IIccImporter
Task<IResponse> ImportPrivacyCategoriesAsync(List<PrivacyCategoryData> categories);

Task<IResponse> ImportRoomsAsync(List<RoomData> rooms);

Task<IResponse> ImportFreeLessonTimespansAsync(List<FreeLessonTimespanData> timespans);
}
}
6 changes: 6 additions & 0 deletions IccImport/IccImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class IccImporter : IIccImporter
public const string AbsencesUrl = "absences";
public const string PrivacyCategoryUrl = "privacy/categories";
public const string RoomUrl = "rooms";
public const string FreeLessonTimespanUrl = "free_lessons";

private readonly ILogger<IccImporter> logger;

Expand Down Expand Up @@ -198,5 +199,10 @@ public Task<IResponse> ImportRoomsAsync(List<RoomData> rooms)
{
return ImportAsync(new RoomsData { Rooms = rooms }, RoomUrl);
}

public Task<IResponse> ImportFreeLessonTimespansAsync(List<FreeLessonTimespanData> timespans)
{
return ImportAsync(new FreeLessonTimespansData { FreeLessons = timespans }, FreeLessonTimespanUrl);
}
}
}
18 changes: 18 additions & 0 deletions IccImport/Models/FreeLessonTimespanData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Newtonsoft.Json;
using System;

namespace SchulIT.IccImport.Models
{
public class FreeLessonTimespanData
{

[JsonProperty("date")]
public DateTime Date { get; set; }

[JsonProperty("start")]
public int Start { get; set; }

[JsonProperty("end")]
public int End { get; set; }
}
}
11 changes: 11 additions & 0 deletions IccImport/Models/FreeLessonTimespansData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Newtonsoft.Json;
using System.Collections.Generic;

namespace SchulIT.IccImport.Models
{
internal class FreeLessonTimespansData
{
[JsonProperty("free_lessons")]
public IList<FreeLessonTimespanData> FreeLessons { get; set; }
}
}

0 comments on commit 07a5a17

Please sign in to comment.