Further AutoMapper changes

This commit is contained in:
Ben
2015-07-01 22:28:29 +01:00
parent 440254f3f8
commit c3d11da155
2 changed files with 7 additions and 9 deletions

View File

@@ -28,8 +28,6 @@ namespace Filtration.ThemeEditor.Providers
public IThemeViewModel NewThemeForScript(ItemFilterScript script)
{
Mapper.CreateMap<ThemeComponent, ThemeComponentViewModel>();
var themeComponentViewModels = Mapper.Map<ObservableCollection<ThemeComponentViewModel>>(script.ThemeComponents);
var themeViewModel = _themeViewModelFactory.Create();
themeViewModel.Initialise(themeComponentViewModels, true);
@@ -40,9 +38,6 @@ namespace Filtration.ThemeEditor.Providers
public IThemeViewModel LoadThemeFromFile(string filePath)
{
Mapper.CreateMap<Theme, IThemeViewModel>().ConstructUsingServiceLocator();
Mapper.CreateMap<ThemeComponent, ThemeComponentViewModel>();
var model = _themePersistenceService.LoadTheme(filePath);
var viewModel = Mapper.Map<IThemeViewModel>(model);
viewModel.FilePath = filePath;
@@ -56,9 +51,6 @@ namespace Filtration.ThemeEditor.Providers
public void SaveTheme(IThemeViewModel themeViewModel, string filePath)
{
Mapper.CreateMap<IThemeViewModel, Theme>();
Mapper.CreateMap<ThemeComponentViewModel, ThemeComponent>();
var theme = Mapper.Map<Theme>(themeViewModel);
_themePersistenceService.SaveTheme(theme, filePath);
}