public SessionBaseEntity MapToSessionBaseEntity(SessionDataDTO source, SessionBaseEntity target = null) { if (source == null) { return(null); } if (target == null) { target = GetSessionBaseEntity(source); } if (!MapToRevision(source, target)) { return(target); } target.SessionType = source.SessionType; target.CreatedByUserId = source.CreatedByUserId; target.LastModifiedByUserId = source.LastModifiedByUserId; target.Date = source.Date; target.Duration = source.Duration; target.LocationId = source.LocationId; //target.Schedule = GetScheduleEntity(source.Schedule); target.SessionResult = GetResultEntity(source.SessionResult); //MapCollection(source.Reviews, target.Reviews, (src, trg) => GetReviewEntity(src), src => src.ReviewId); return(target); }
public SessionDataDTO MapToSessionDataDTO(SessionBaseEntity source, SessionDataDTO target = null) { if (source == null) { return(null); } if (target == null) { target = new SessionDataDTO(); } MapToSessionInfoDTO(source, target); target.CreatedByUserId = source.CreatedByUserId; target.LastModifiedByUserId = source.LastModifiedByUserId; target.Date = source.Date.GetValueOrDefault(); target.Duration = source.Duration; target.LocationId = source.LocationId; target.Schedule = MapToScheduleInfoDTO(source.Schedule); target.SessionResult = MapToResultInfoDTO(source.SessionResult); target.Reviews = source.Reviews.Select(x => MapToReviewInfoDTO(x)).ToArray(); return(target); }