mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-12-22 23:26:31 +01:00
48 lines
1.2 KiB
C#
48 lines
1.2 KiB
C#
using System;
|
|
|
|
namespace ShareeBike.Model.Bikes.BikeInfoNS.CopriLock
|
|
{
|
|
public class BikeInfoMutable : BC.BikeInfoMutable, IBikeInfoMutable
|
|
{
|
|
/// <summary> Constructs a bike object from source. </summary>
|
|
public BikeInfoMutable(BikeInfo bike, string stationName) : base(
|
|
bike != null
|
|
? bike.Bike
|
|
: throw new ArgumentNullException(nameof(bike)),
|
|
bike.Drive,
|
|
bike.DataSource,
|
|
bike.IsDemo,
|
|
bike.Group,
|
|
bike.StationId,
|
|
stationName,
|
|
bike.OperatorUri,
|
|
bike.TariffDescription,
|
|
() => DateTime.Now,
|
|
bike.State)
|
|
{
|
|
LockInfo = new LockInfoMutable(bike.LockInfo.State);
|
|
|
|
BookingFinishedModel = new BookingFinishedModel
|
|
{
|
|
Co2Saving = bike.Co2Saving,
|
|
MiniSurvey = new MiniSurvey.MiniSurveyModel()
|
|
};
|
|
|
|
if ((bike?.MiniSurvey?.Questions) == null
|
|
|| bike.MiniSurvey.Questions.Count <= 0)
|
|
{
|
|
// No querries to add.
|
|
return;
|
|
}
|
|
|
|
// Add a dummy query. Querries are not yet read from COPRI but compiled into the app.
|
|
BookingFinishedModel.MiniSurvey.Questions.Add("q1", new MiniSurvey.QuestionModel());
|
|
}
|
|
|
|
public LockInfoMutable LockInfo { get; }
|
|
|
|
ILockInfoMutable IBikeInfoMutable.LockInfo => LockInfo;
|
|
|
|
public IBookingFinishedModel BookingFinishedModel { get; }
|
|
}
|
|
}
|