2012-11-04 04:39:29 +03:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Text;
|
|
|
|
using AutoMapper;
|
|
|
|
using NzbDrone.Api.QualityProfiles;
|
2013-01-02 05:06:55 +03:00
|
|
|
using NzbDrone.Api.QualityType;
|
2012-11-09 19:28:59 +03:00
|
|
|
using NzbDrone.Api.Resolvers;
|
2012-11-04 04:39:29 +03:00
|
|
|
using NzbDrone.Core.Repository.Quality;
|
|
|
|
|
|
|
|
namespace NzbDrone.Api
|
|
|
|
{
|
|
|
|
public static class Bootstrapper
|
|
|
|
{
|
|
|
|
public static void Initialize()
|
|
|
|
{
|
2013-01-02 05:06:55 +03:00
|
|
|
//QualityProfiles
|
2012-12-03 06:08:26 +03:00
|
|
|
Mapper.CreateMap<QualityProfileModel, QualityProfile>()
|
|
|
|
.ForMember(dest => dest.QualityProfileId, opt => opt.MapFrom(src => src.Id))
|
|
|
|
.ForMember(dest => dest.Allowed, opt => opt.ResolveUsing<QualitiesToAllowedResolver>().FromMember(src => src.Qualities));
|
|
|
|
|
|
|
|
Mapper.CreateMap<QualityProfile, QualityProfileModel>()
|
|
|
|
.ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.QualityProfileId))
|
|
|
|
.ForMember(dest => dest.Qualities, opt => opt.ResolveUsing<AllowedToQualitiesResolver>().FromMember(src => src.Allowed));
|
2012-11-24 11:03:38 +03:00
|
|
|
|
|
|
|
Mapper.CreateMap<QualityTypes, QualityProfileType>()
|
|
|
|
.ForMember(dest => dest.Allowed, opt => opt.Ignore());
|
2013-01-02 05:06:55 +03:00
|
|
|
|
|
|
|
//QualityTypes
|
|
|
|
Mapper.CreateMap<QualityTypeModel, Core.Repository.Quality.QualityType>()
|
|
|
|
.ForMember(dest => dest.QualityTypeId, opt => opt.MapFrom(src => src.Id));
|
|
|
|
|
|
|
|
Mapper.CreateMap<Core.Repository.Quality.QualityType, QualityTypeModel>()
|
|
|
|
.ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.QualityTypeId));
|
2012-11-04 04:39:29 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|