/// <summary> /// Popualte movie data /// Create a new entity if none given /// </summary> /// <param name="dto"></param> /// <param name="entity"></param> /// <returns></returns> public static Movie Populate(MovieDto dto, Movie entity = null) { if (entity == null) { entity = new Movie(); } entity.Name = dto.Name; entity.ReleaseDate = dto.ReleaseDate; entity.TimeLength = dto.TimeLength; entity.PG = dto.PG; entity.Real = FullNameDto.Serialize(dto.Real); entity.Actors = FullNameDto.Serialize(dto.Actors); entity.Synopsis = dto.Synopsis; return(entity); }
/// <summary> /// Extract entity data /// </summary> /// <param name="entity"></param> /// <returns></returns> public static MovieDto Extract(Movie entity) { var dto = new MovieDto(); if (entity == null) { return(dto); } dto.Id = entity.Id; dto.Name = entity.Name; dto.ReleaseDate = entity.ReleaseDate; dto.TimeLength = entity.TimeLength; dto.PG = entity.PG; dto.Real = FullNameDto.ParseString(entity.Real); dto.Actors = FullNameDto.ParseString(entity.Actors); dto.Image = entity.Image; dto.Synopsis = entity.Synopsis; return(dto); }