예제 #1
0
 /// <summary>
 /// Convert RaceResult Entity  into RaceResult Object
 /// </summary>
 ///<param name="model">RaceResultViewModel</param>
 ///<param name="RaceResultEntity">DataAccess.RaceResult</param>
 ///<returns>RaceResultViewModel</returns>
 public static RaceResultViewModel ToViewModel(
     this DataAccess.RaceResult entity,
     RaceResultViewModel model)
 {
     model.Id             = entity.Id;
     model.RaceDistanceId = entity.RaceDistanceId;
     model.TimeTaken      = entity.TimeTaken ?? TimeSpan.MinValue;
     model.AveragePace    = entity.AveragePace ?? TimeSpan.MinValue;
     model.MemberId       = entity.MemberId;
     model.IsActive       = entity.IsActive;
     return(model);
 }
예제 #2
0
 /// <summary>
 /// Convert RaceResult Object into RaceResult Entity
 /// </summary>
 ///<param name="model">RaceResult</param>
 ///<param name="RaceResultEntity">DataAccess.RaceResult</param>
 ///<returns>DataAccess.RaceResult</returns>
 public static DataAccess.RaceResult ToEntity(this RaceResultViewModel model,
                                              DataAccess.RaceResult entity)
 {
     if (entity.Id == 0)
     {
         entity.CreatedUserId = model.SessionUserId;
         entity.IsActive      = model.IsActive;
     }
     else
     {
         entity.UpdatedUserId    = model.SessionUserId;
         entity.UpdatedTimestamp = DateTime.Now;
     }
     entity.RaceDistanceId = model.RaceDistanceId;
     entity.TimeTaken      = model.TimeTaken;
     entity.MemberId       = model.MemberId;
     entity.Position       = model.Position;
     return(entity);
 }