Beispiel #1
0
 public static FilterViewModel MapToFilterViewModel(Filter filter)
 {
     if (filter != null)
     {
         return(new FilterViewModel()
         {
             Id = filter.Id,
             SelectedSize = FileSizeMap.MapToFileSizeViewModel(filter.FileSize),
             SelectedType = FileTypeMap.MapToFileTypeViewModel(filter.FileType),
             IsSeries = filter.IsSeries,
             IsAllMovies = filter.IsAllMovies,
             IsFavorite = filter.IsFavorite,
             IsMoreCD = filter.IsMoreCD,
             DateFrom = filter.DateFrom,
             DateTo = filter.DateTo
         });
     }
     else
     {
         return(new FilterViewModel());
     }
 }
Beispiel #2
0
 public static SettingViewModel MapToSettingViewModel(Setting setting)
 {
     if (setting != null)
     {
         return(new SettingViewModel()
         {
             Id = setting.Id,
             ServerIP = setting.ServerIP,
             Port = setting.Port,
             UserName = Environment.UserDomainName + "/" + Environment.UserName,
             IsSearchForSubtitle = setting.IsSearchForSubtitle,
             ConnectedPhone = setting.ConnectedPhone,
             MoviesPath = setting.MoviesPath,
             FileTypeViewModels = FileTypeMap.MapToFileTypeViewModelList(setting.FileTypes.Where(t => t.Id != 1).ToList()),
             SelectedAccentColor = convertByteArrayToColor(setting.SelectedAccentColor),
             SelectedTheme = setting.SelectedTheme
         });
     }
     else
     {
         return(new SettingViewModel());
     }
 }
Beispiel #3
0
 public static Setting MapSettingViewModelToSetting(SettingViewModel settingViewModel)
 {
     if (settingViewModel != null)
     {
         return(new Setting()
         {
             Id = settingViewModel.Id,
             ServerIP = settingViewModel.ServerIP,
             Port = settingViewModel.Port,
             UserName = settingViewModel.UserName,
             IsSearchForSubtitle = settingViewModel.IsSearchForSubtitle,
             ConnectedPhone = settingViewModel.ConnectedPhone,
             MoviesPath = settingViewModel.MoviesPath,
             FileTypes = FileTypeMap.MapToFileTypeList(settingViewModel.FileTypeViewModels.Where(t => t.Id != 1).ToList()),
             SelectedAccentColor = convertColorToByteArray(settingViewModel.SelectedAccentColor),
             SelectedTheme = settingViewModel.SelectedTheme
         });
     }
     else
     {
         return(null);
     }
 }
Beispiel #4
0
 public static Filter MapFilterViewModelToFilter(FilterViewModel filterViewModel)
 {
     if (filterViewModel != null)
     {
         return(new Filter()
         {
             Id = filterViewModel.Id,
             FileSizeId = filterViewModel.SelectedSize.Id,
             FileSize = FileSizeMap.MapFileSizeViewModelToFileSize(filterViewModel.SelectedSize),
             FileTypeId = filterViewModel.SelectedType.Id,
             FileType = FileTypeMap.MapToFileType(filterViewModel.SelectedType),
             IsSeries = filterViewModel.IsSeries,
             IsAllMovies = filterViewModel.IsAllMovies,
             IsFavorite = filterViewModel.IsFavorite,
             IsMoreCD = filterViewModel.IsMoreCD,
             DateFrom = filterViewModel.DateFrom,
             DateTo = filterViewModel.DateTo
         });
     }
     else
     {
         return(null);
     }
 }