public BaseDTO GetDTO(EntityBase entity) { if (entity is Team) { return(teamConverter.GetDTO(entity as Team)); } if (entity is User) { return(userConverter.GetDTO(entity as User)); } throw new Exception($"No converter for {entity} object!"); }
public override UserDTO GetDTO(User entity) { UserDTO dto = new UserDTO(); dto.Id = entity.Id; dto.Login = entity.Login; dto.PasswordHash = entity.PasswordHash; if (string.IsNullOrEmpty(entity.Callsign)) { dto.Callsign = entity.Callsign; } if (entity.Team != null) { dto.Team = teamConverter.GetDTO(entity.Team); } return(dto); }