80 lines
3.0 KiB
C#

using Marco.Pms.Model.Dtos.Master;
using Marco.Pms.Model.Master;
using Marco.Pms.Model.ViewModels.Master;
namespace Marco.Pms.Model.Mapper
{
public static class MasterMapper
{
// -------------------------------- Work Category --------------------------------
public static WorkCategoryMaster ToWorkCategoryMasterFromWorkCategoryMasterDto(this WorkCategoryMasterDto categoryMasterDto, Guid tenantId)
{
return new WorkCategoryMaster
{
Id = categoryMasterDto.Id ?? Guid.Empty,
Name = categoryMasterDto.Name,
Description = categoryMasterDto.Description ?? "",
TenantId = tenantId
};
}
public static WorkCategoryMasterVM ToWorkCategoryMasterVMFromWorkCategoryMaster(this WorkCategoryMaster categoryMaster)
{
return new WorkCategoryMasterVM
{
Id = categoryMaster.Id,
Name = categoryMaster.Name,
Description = categoryMaster.Description ?? "",
IsSystem = categoryMaster.IsSystem
};
}
// -------------------------------- Services --------------------------------
public static ServicesMaster ToServicesMasterFromServiceMasterDto(this ServiceMasterDto model, Guid tenantId)
{
return new ServicesMaster
{
Name = model.Name ?? string.Empty,
Description = model.Description ?? string.Empty,
TenantId = tenantId
};
}
public static ServiceMasterVM ToServiceMasterVMFromServiceMaster(this ServicesMaster model)
{
return new ServiceMasterVM
{
Id = model.Id,
Name = model.Name,
Description = model.Description,
IsActive = model.IsActive,
IsSystem = model.IsSystem
};
}
// -------------------------------- Activity Group --------------------------------
public static ActivityGroupMaster ToActivityGroupMasterFromActivityGroupDto(this ActivityGroupDto model, Guid tenantId)
{
return new ActivityGroupMaster
{
ServiceId = model.ServiceId,
Name = model.Name ?? string.Empty,
Description = model.Description ?? string.Empty,
TenantId = tenantId
};
}
public static ActivityGroupMasterVM ToActivityGroupMasterVMFromActivityGroupMaster(this ActivityGroupMaster model, string serviceName)
{
return new ActivityGroupMasterVM
{
Id = model.Id,
ServiceId = model.ServiceId,
ServicesName = serviceName,
Name = model.Name ?? string.Empty,
Description = model.Description ?? string.Empty,
IsActive = model.IsActive,
IsSystem = model.IsSystem
};
}
}
}