irc-netcore-api/IRaCIS.Core.Application/Service/Allocation/_MapConfig.cs

36 lines
1.2 KiB
C#

using AutoMapper;
using IRaCIS.Application.Contracts;
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Models;
namespace IRaCIS.Core.Application.Service
{
public class AllocationConfig : Profile
{
public AllocationConfig()
{
CreateMap<TaskAllocationRule, TaskAllocationRuleView>()
.ForMember(o => o.TotalTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count()))
.ForMember(o => o.SelfTaskCount, t => t.MapFrom(u => u.Trial.VisitTaskList.Count(t=>t.DoctorUserId==u.DoctorUserId)));
CreateMap<VisitTask, VisitTaskView>()
.ForMember(o => o.SiteId, t => t.MapFrom(u => u.Subject.SiteId))
.ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.Subject.TrialSite.TrialSiteCode))
.ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Subject.Code));
CreateMap<TaskAllocationRuleAddOrEdit, TaskAllocationRule>();
CreateMap<User, TrialDoctorUserSelectView>()
.ForMember(o => o.DoctorUserId, t => t.MapFrom(u => u.Id))
.ForMember(o => o.FullName, t => t.MapFrom(u => u.FullName));
}
}
}