示例#1
0
        public static MediaTO ToTransferObject(this MediaEF media)
        {
            if (media is null)
            {
                throw new ArgumentNullException(nameof(media));
            }

            return(new MediaTO
            {
                Id = media.Id,
                Name = media.Name,
                Path = media.Path,
                Type = media.Type
            });
        }
        public static MediaEF ToTrackedEF(this MediaTO media, MediaEF mediaToModify)
        {
            if (mediaToModify is null)
            {
                throw new ArgumentNullException(nameof(mediaToModify));
            }
            if (media is null)
            {
                throw new ArgumentNullException(nameof(media));
            }

            mediaToModify.Id   = media.Id;
            mediaToModify.Name = media.Name;
            mediaToModify.Type = media.Type;
            mediaToModify.Path = media.Path;

            return(mediaToModify);
        }