/// <summary> /// Initializes a new instance of the <see cref="FileDTO"/> class. /// </summary> /// <param name="file"> /// The image. /// </param> public FileDTO(File file) { this.fileId = file.Id.ToString(); this.parentFileId = file.ParentFile.With(x => x.Id.ToString()); this.breakoutRoomId = file.BreakoutRoomId; this.dateCreated = file.DateCreated.With(x => x.ConvertToUnixTimestamp());; this.fileName = file.FileName; this.fileSize = file.FileSize; this.topicName = file.TopicName; this.description = file.Description; this.categoryId = file.Category.Return(x => x.Id, (int?)null); this.userId = file.UserId; this.displayName = file.DisplayName; this.dateModified = file.DateModified.Return(x => x.Value.ConvertToUnixTimestamp(), (double?)null); this.fileNumber = file.FileNumber; this.categoryName = file.Category.With(c => c.CategoryName); this.userName = file.UserId.ToString(); this.topicVo = new TopicDTO(file.Topic); this.topicId = this.topicVo.Return(x => x.topicId, (int?)null); this.isShared = file.IsShared.HasValue && file.IsShared.Value; this.isOriginal = file.IsOriginal.HasValue && file.IsOriginal.Value; this.acMeetingUrl = file.AcMeetingUrl; if (file.Status != null) { this.fileStatus = (int)file.Status; } this.numberOfPages = file.NumberOfPages ?? 0; this.uploadStatus = (int)file.UploadFileStatus; }
/// <summary> /// Initializes a new instance of the <see cref="FileDTO"/> class. /// </summary> /// <param name="file"> /// The image. /// </param> public FileDTO(File file) { this.fileId = file.Id; this.dateCreated = file.DateCreated; this.fileName = file.FileName; this.fileSize = file.FileSize; this.topicName = file.TopicName; this.description = file.Description; this.categoryId = file.Category.Return(x => x.Id, (int?)null); this.userId = file.User.Return(x => x.Id, (int?)null); this.displayName = file.DisplayName; this.dateModified = file.DateModified ?? file.DateCreated; this.fileNumber = file.FileNumber; this.categoryName = file.Category.With(c => c.CategoryName); this.userName = file.User.Return(x => x.FullName, null); this.topicVo = new TopicDTO(file.Topic); this.topicId = this.topicVo.Return(x => x.topicId, (int?)null); this.isShared = file.IsShared.HasValue && file.IsShared.Value; this.isOriginal = file.IsOriginal.HasValue && file.IsOriginal.Value; this.acMeetingUrl = file.AcMeetingUrl; if (file.Status != null) { this.fileStatus = (int)file.Status; } this.numberOfPages = file.NumberOfPages ?? 0; this.uploadStatus = (int)file.UploadFileStatus; }