/// <summary> /// Converts Models.MiBandSleep into Entities.MiBandSleep /// </summary> /// <param name="model">Models.MiBandSleep to convert</param> /// <param name="created">DateTime of creation (taken from summary)</param> /// <param name="user">User that performed activity</param> /// <returns>New instance of Entities.MiBandSleep</returns> public static MiBandSleep ToEntity(this Models.MiBandSleep model, DateTime created, User user) { var e = new MiBandSleep { AwakeDuration = model.AwakeDuration, Created = created, DeepSleepDuration = model.DeepSleepDuration, End = model.End, LightSleepDuration = model.LightSleepDuration, Start = model.Start, User = user, UserId = user.Id }; return e; }
/// <summary> /// Converts Models.MiBandActivity into Entities.MiBandActivity /// </summary> /// <param name="model">Models.MiBandActivity to convert</param> /// <param name="created">DateTime of creation (taken from summary)</param> /// <param name="goal">Goal of activity (taken from summary)</param> /// <param name="user">User that performed activity</param> /// <returns>New instance of Entities.MiBandActivity</returns> public static MiBandActivity ToEntity(this Models.MiBandActivity model, DateTime created, int goal, User user) { var e = new MiBandActivity { DailyBurnCalories = model.DailyBurnCalories, DailyDistanceMeter = model.DailyDistanceMeter, DailySteps = model.DailySteps, Goal = goal, Created = created, RunBurnCalories = model.RunBurnCalories, RunDistanceMeter = model.RunDistanceMeter, RunTimeDuration = model.RunTimeDuration, WalkTimeDuration = model.WalkTimeDuration, User = user, UserId = user.Id }; return e; }