public static MESpecialist ToMESpecialist(this SpecialistViewModel dto) { MESpecialist entity = new MESpecialist(); entity.CopyPropertiesFrom(dto); return(entity); }
public static SpecialistViewModel ToSpecialistViewModel(this MESpecialist entity) { if (entity == null) { return(null); } SpecialistViewModel dto = new SpecialistViewModel(); dto.CopyPropertiesFrom(entity); dto.MESpecialistID = entity.MESpecialistID; dto.TotalDoctor = entity.MEDoctorSpecialists.IsNullOrEmpty() ? 0 : entity.MEDoctorSpecialists.Count(x => x.FK_MEDoctorID.HasValue); dto.ChiefDoctor = entity.MEDoctor.ToDoctorViewModel(); dto.Type = entity.MESpecialistType.ToSpecialistTypeViewModel(); dto.Doctors = entity.MEDoctorSpecialists.IsNullOrEmpty() ? null : entity.MEDoctorSpecialists.Select(x => x.MEDoctor.ToDoctorViewModel().FullUrlImageDoctor()).ToArray(); return(dto); }