public List <APIPostCardModel> MapPostCardDTOsToModels(List <PostCardDTO> postCardDTOs) { if (postCardDTOs == null) { return(null); } List <APIPostCardModel> postCardModels = new List <APIPostCardModel>(); foreach (PostCardDTO postCardDTO in postCardDTOs) { APIPostCardModel postCardModel = MapPostCardDTOToModel(postCardDTO); postCardModels.Add(postCardModel); } return(postCardModels); }
public APIPostCardModel MapPostCardDTOToModel(PostCardDTO postCardDTO) { if (postCardDTO == null) { return(null); } CategoryDTO categoryDTO = postCardDTO.PostCategory; APIPostCardModel postCardModel = new APIPostCardModel() { PostId = postCardDTO.PostId, Title = postCardDTO.Title, ShortDescription = postCardDTO.ShortDescription, ThumbnailImageSrc = postCardDTO.ThumbnailImageSrc, CreatedDate = FormatTime(postCardDTO.CreatedDate), UpdatedDate = FormatTime(postCardDTO.UpdatedDate), PostCategory = MapPostCategoryDTOToModel(postCardDTO.PostCategory), CommentCount = postCardDTO.CommentCount }; return(postCardModel); }