Добавлен справочник ResponseArea
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using AutoMapper;
|
||||
using PARR.DAL.Contracts;
|
||||
using PARR.DAL.Models;
|
||||
using PARR.DAL.Models.AIHIT;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace PARR.AIHIT.MappingProfiles.Resolvers
|
||||
{
|
||||
internal class EkStatusCodeResolver : IValueResolver<RawDataEK, Host, int>
|
||||
{
|
||||
public int Resolve(RawDataEK source, Host destination, int destMember, ResolutionContext context)
|
||||
{
|
||||
var pattern = "\\d+";
|
||||
var regex = new Regex(pattern);
|
||||
|
||||
int.TryParse(regex.Match(source.Status!).Value, out int result);
|
||||
|
||||
if (!Enum.IsDefined(typeof(EkStatusEnum), result))
|
||||
throw new Exception($"Неверный статус ЭК {source.Status}");
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user