removed conversion code from SQLiteRepository.cs in favour of new converters. pulled out string queries from SQLiteRepository and moved to SQLiteProcedures.cs. #95
43 lines
1.3 KiB
C#
43 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Interfaces;
|
|
|
|
namespace SQLiteRepository.Converters
|
|
{
|
|
static class TimeLogConverter
|
|
{
|
|
public static TimeLog ConvertToTimeLogDto(TimeLogDb log)
|
|
{
|
|
return new TimeLog
|
|
{
|
|
CalendarWeek = log.CalendarWeek,
|
|
Direction = LogDirectionConverter.ConvertToLogDirectionDto(log.Direction),
|
|
EventTime = log.SwipeEventDateTime,
|
|
Id = log.Id,
|
|
IdentifierId = log.IdentifierId,
|
|
UserId = log.UserId_FK,
|
|
Source = LogSourceConverter.ConvertToLogSourceDto(log.Source),
|
|
Year = log.Year
|
|
};
|
|
}
|
|
|
|
public static TimeLogDb ConvertFromTimeLogDto(TimeLog log)
|
|
{
|
|
return new TimeLogDb
|
|
{
|
|
CalendarWeek = log.CalendarWeek,
|
|
Year = log.Year,
|
|
UserId_FK = log.UserId,
|
|
IdentifierId = log.IdentifierId,
|
|
Direction = LogDirectionConverter.ConvertFromLogDirectionDto(log.Direction),
|
|
Id = log.Id,
|
|
Source = LogSourceConverter.ConvertFromLogSourceDto(log.Source),
|
|
SwipeEventDateTime = log.EventTime
|
|
};
|
|
}
|
|
}
|
|
}
|