Пример #1
0
        public static BookViewModel ToViewModel(this BookEntity entity)
        {
            BookViewModel vm = new BookViewModel();

            vm.ID          = entity.ID;
            vm.Title       = entity.Title;
            vm.Image       = entity.Image;
            vm.OriginTitle = entity.OriginTitle;
            vm.Summary     = entity.Summary;
            vm.Authors     = SerializerHelper.DeserializeByJsonConvert <List <string> >(entity.Authors);
            vm.Translators = SerializerHelper.DeserializeByJsonConvert <List <string> >(entity.Translators);
            vm.Create      = DateTimeUtil.ConvertTime(entity.Create);
            return(vm);
        }