public static OutCompleteCarDTO CompleteMap(Car car) { return(new OutCompleteCarDTO { Id = car.Id, Model = car.Model, RegistrationPlate = car.RegistrationPlate, Assignments = car.Users .Where(uc => uc != null) .Select(uc => Map(uc)), Tools = car.Tools .Where(ct => ct != null) .Select(ct => ToolMapper.Map(ct)) }); }
public static OutCompleteReportDTO CompleteMap(Report report) { return(new OutCompleteReportDTO { Id = report.Id, User = UserMapper.Map(report.User), Car = CarMapper.Map(report.Car), Created = report.Created, Comment = report.Comment, ReportItems = report.ReportItems.Select(reportItem => new OutReportItemDTO { Id = reportItem.Id, Tool = reportItem.Tool == null ? null : ToolMapper.Map(reportItem.Tool), Material = reportItem.Material == null ? null : MaterialMapper.Map(reportItem.Material), Amount = reportItem.Amount, Comment = reportItem.Comment }) }); }