public ScheduleModel ConvertScheduleToDTO(Schedule schedule) { List <AlertModel> alerts = new List <AlertModel>(); foreach (var alert in schedule.Alerts) { alerts.Add(ConvertAlertToDTO(alert)); } ScheduleModel output = new ScheduleModel { Alerts = alerts, Name = schedule.Name }; return(output); }
public Schedule ConvertScheduleFromDTO(ScheduleModel dto) { List <Alert> alerts = new List <Alert>(); foreach (AlertModel alert in dto.Alerts) { alerts.Add(ConvertAlertFromDto(alert)); } Schedule output = new Schedule { Name = dto.Name, Alerts = alerts }; return(output); }