Template Response
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using AutoMapper;
|
||||
using PARR.API.Contracts.V1.Responses;
|
||||
using PARR.API.MappingProfiles.Resolvers;
|
||||
using PARR.DAL.Models;
|
||||
using PARR.DAL.Models.V1;
|
||||
|
||||
@@ -33,16 +34,15 @@ namespace PARR.API.MappingProfiles
|
||||
.ForMember(d => d.Branch, o => o.MapFrom(s => s.Host!.ResponseArea))
|
||||
.ForMember(d => d.SlaInterval, o => o.MapFrom(s => s.ApplicationsInWork!.Work!.TemplateDuration))
|
||||
.ForMember(d => d.ConfigurationItem, o => o.MapFrom(s => s.Host!.Ek))
|
||||
//.ForMember(d => d.ContactName, o => o.MapFrom(s => s.Initiator))
|
||||
.ForMember(d => d.ContactName, o => o.MapFrom<TemplateInitiatorResolver>())
|
||||
.ForMember(d => d.Description, o => o.MapFrom(s => s.ApplicationsInWork!.Work!.FullDescription))
|
||||
//.ForMember(d => d.ResolutionCode, o => o.MapFrom(s => s.ClosingCode))
|
||||
.ForMember(d => d.ResolutionCode, o => o.MapFrom<TemplateClosingCodeResolver>())
|
||||
.ForMember(d => d.Resolution, o => o.MapFrom(s => s.ApplicationsInWork!.Work!.Solution))
|
||||
.ForMember(d => d.RzdMTNKprocess, o => o.MapFrom(s => s.ApplicationsInWork!.Work!.Tnk!.Subprocess!.Process!.Name))
|
||||
.ForMember(d => d.RzdMTNKsubprocess, o => o.MapFrom(s => s.ApplicationsInWork!.Work!.Tnk!.Subprocess!.Name))
|
||||
.ForMember(d => d.RzdMTNKtnk, o => o.MapFrom(s => s.ApplicationsInWork!.Work!.Tnk!.Name))
|
||||
.ForMember(d => d.RzdMTNKjob, o => o.MapFrom(s => s.ApplicationsInWork!.Work!.Name))
|
||||
//.ForMember(d => d.Assignee, o => o.MapFrom(s => s.Worker))
|
||||
;
|
||||
.ForMember(d => d.Category, o => o.MapFrom<TemplateCategoryResolver>());
|
||||
|
||||
CreateMap<TemplateResponse, TemplateStringResponse>();
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace PARR.API.MappingProfiles.Resolvers
|
||||
{
|
||||
public class _
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using AutoMapper;
|
||||
using PARR.API.Contracts.V1.Responses;
|
||||
using PARR.DAL.Contracts;
|
||||
using PARR.DAL.Models;
|
||||
|
||||
namespace PARR.API.MappingProfiles.Resolvers
|
||||
{
|
||||
public class TemplateCategoryResolver : IValueResolver<Template, TemplateResponse, string>
|
||||
{
|
||||
private readonly SettingsFromDb settingsFromDb;
|
||||
|
||||
public TemplateCategoryResolver(SettingsFromDb settingsFromDb)
|
||||
{
|
||||
this.settingsFromDb = settingsFromDb;
|
||||
}
|
||||
|
||||
public string Resolve(Template source, TemplateResponse destination, string destMember, ResolutionContext context)
|
||||
{
|
||||
return settingsFromDb.Category;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using AutoMapper;
|
||||
using PARR.API.Contracts.V1.Responses;
|
||||
using PARR.DAL.Contracts;
|
||||
using PARR.DAL.Models;
|
||||
|
||||
namespace PARR.API.MappingProfiles.Resolvers
|
||||
{
|
||||
public class TemplateClosingCodeResolver : IValueResolver<Template, TemplateResponse, string>
|
||||
{
|
||||
private readonly SettingsFromDb settingsFromDb;
|
||||
|
||||
public TemplateClosingCodeResolver(SettingsFromDb settingsFromDb)
|
||||
{
|
||||
this.settingsFromDb = settingsFromDb;
|
||||
}
|
||||
|
||||
public string Resolve(Template source, TemplateResponse destination, string destMember, ResolutionContext context)
|
||||
{
|
||||
return settingsFromDb.ClosingCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using AutoMapper;
|
||||
using PARR.API.Contracts.V1.Responses;
|
||||
using PARR.DAL.Contracts;
|
||||
using PARR.DAL.Models;
|
||||
|
||||
namespace PARR.API.MappingProfiles.Resolvers
|
||||
{
|
||||
public class TemplateInitiatorResolver : IValueResolver<Template, TemplateResponse, string>
|
||||
{
|
||||
private readonly SettingsFromDb settingsFromDb;
|
||||
|
||||
public TemplateInitiatorResolver(SettingsFromDb settingsFromDb)
|
||||
{
|
||||
this.settingsFromDb = settingsFromDb;
|
||||
}
|
||||
|
||||
public string Resolve(Template source, TemplateResponse destination, string destMember, ResolutionContext context)
|
||||
{
|
||||
return settingsFromDb.Initiator;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user